Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [filetype]

Questions about making Vim to have a defined behavior according the type of the edited file.

Filter by
Sorted by
Tagged with
2
votes
0answers
21 views

How to fix this `Omni completion (^O^N^P) Pattern not found` error?

I am trying to set up syntax keyword based omnicompletion in vim. I have defined a few syntax keyword Constants in ~/.config/nvim/syntax/spl.vim They are correctly detected and highlighted. They are ...
1
vote
1answer
26 views

Vim different colorchemes for different file, but same backgroung color

I'd like to have a colorscheme but keeping my terminal color as a background color. This code achieved that colorscheme MyFavoriteOne autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE I'...
1
vote
1answer
61 views

Is it possible to have vim run a command every time save `:w` is invoked?

I am editting typescript now, and I'd like to be able to have it so, whenever :w is invoked, the shell runs tsc compiling my new save. This beats having to !tsc every time. Does something like this ...
3
votes
2answers
115 views

Multiple vimrc files for different file types in vim?

I'm a vim beginner. I want to handle multiple programming languages. I find great resources for how to perfect vim for one programming language by putting ton of stuff in one vimrc file. This is ...
1
vote
1answer
26 views

How to disable intelligent indent for text/markdown files?

Since ever in my configuration of vim text and markdown-files are indented on following lines to align with open parenthesis. Text Text Text (e.g. Hello World) More Text This happens ...
1
vote
1answer
26 views

What does “one file for each filtype” mean in :h new-filetype

From :h new-filetype : A. If you want to overrule all default file type checks. This works by writing one file for each filetype. The disadvantage is that means there can be many files. The ...
1
vote
1answer
69 views

Why set ft is not working?

I have au BufRead,BufNewFile *.vm set ft=velocity in vimrc. But if open .vm file and run :set filetype?, still get filetype=conf. How to fix this?
1
vote
2answers
86 views

Linking a filetype to a syntax file of a different name

I’ve created a new filetype, “usenet,” for Usenet messages. I would like files with this filetype to be highlighted exactly as if they had the “mail” filetype. Is it possible to tell Vim that I want ...
1
vote
0answers
29 views

How to load a template file if new file is starting? [duplicate]

I'm a hobbyist go programmer, and I'm using vim-go to make vim efficient go editor. One thing I like about vim-go is, whenever in a directory, when you open a new .go file. It adds this: package ...
0
votes
1answer
23 views

Vim Jedi Plugin — Add .sage filetype

,g$$$$$$$$$$$$$$$P. OS: Debian 9.9 stretch ,g$$P"" """Y$$.". Kernel: x86_64 Linux 4.19.0-0.bpo.4-amd64 ,$$P' `$$$. Uptime: 3h 17m ',$$P ,ggs. `$$...
1
vote
1answer
50 views

Multi-line array variable in bash with filetype sh does not indent correctly

I have the following bash array after automatic indentation, both on pressing carriage return when was editing in :h Insert mode and doing =ip on the block in :h Normal-mode DOTFILES=( ".bashrc" "....
0
votes
0answers
16 views

How can I reproduce a Linting Plugin Behavior

I'm trying to get in to plugin writing, and currently I'm doing some builds (like Latex and LanguageTools checker), and I have in place hotkeys that call for the compilation, and It throws the output ...
0
votes
1answer
75 views

autocmd for markdown textwidth=100 failing

I want to set my markdown files to have textwidth=100 but cannot get it working. The strange thing is that it works sometimes and sometimes not. My autocmd is: augroup auFileTypes autocmd! ...
0
votes
1answer
161 views

Vim not setting correct file type for jinja files

Whenever I create html file with jinja code from terminal either using shell commands or directly using vim, the file type is always set to html and not jinja.html, which causes number of issues like ...
0
votes
1answer
63 views

fake a filename for filetype detection when reading from stdin

When reading from stdin with something like fancy-command | vim -R -, vim does not detect the filetype (i.e. set filetype prints filetype=). When I know the right vim filetype, I can provide it from ...
0
votes
0answers
60 views

Use a file in ftplugin directory for multiple file types?

Let's say I want to use one file to set settings for xml, html, and plist files. So I have: .vim/after/ftplugin/xml.vim .vim/after/ftplugin/html.vim .vim/after/ftplugin/plist.vim But I want to join ...
0
votes
1answer
73 views

execute 'Goyo' on loading pandoc document

It seems like running the Goyo command (a distraction free editing plugin) on loading a pandoc document should be really simple, but execute "Goyo" in .config/nvim/ftplugin/pandoc.vim leads the ...
1
vote
1answer
53 views

Share configuration across `ftplugin` files without duplicating code

A lot of languages use curly braces {} to enclose code blocks, so it's nice to have a mapping something like: inoremap <buffer> {<CR> {<CR>}<Esc>O I have this mapping in ...
0
votes
0answers
31 views

Automatically uncompress section of buffer

I'm using a simple text file in Vim as a task manager and am keeping completed tasks in an archive section of the same file. I'd like to compress that section of the buffer when saving changes to a ...
4
votes
1answer
269 views

How to debug “Unknown function: dist#ft#SetFileTypeSH” after upgrade to 8.1

edit: Solution found! At the bottom of the post I installed vim 8.1 via brew on macos Sierra yesterday, and I think that broke some of the filetype setting stuff. When I open a shell script, I get ...
0
votes
2answers
60 views

Help for filetype specifics

I often find myself jotting notes in Vim using an empty buffer which in this case has 'no ft' (status line). I know I could set the filetype with :setfiletype text but I honestly wonder what that ...
1
vote
0answers
38 views

Airline section_x for particular filetype

For .js files, I set a particular filetype in order to enable snippets, like this: augroup project autocmd! autocmd BufRead,BufNewFile *.js set filetype=javascript.javascript-es6-react.jsx ...
-1
votes
1answer
132 views

Automatic highlighting non ASCII character when loading 'vim' filetype buffer

I want to include a new highlight group and autocommand that will automatically highlight non-ASCIIs as soon as either a vimscript or a Python file is loaded in buffer (i.e. any file with filetype '...
2
votes
0answers
207 views

Support for embedded languages

Vim supports syntax highlighting for embedded languages, also called fenced code (:h :syn-include). However, you usually want that other vim settings and mappings are adjusted for embedded languages ...
3
votes
1answer
33 views

Ask if file extension is missing when opening new file

I use auto completion in my shell (zsh) and I'm often a bit sloppy. Scenario: Imagine I have the files sourcecode.c and sourcecode.h in the current directory. I type vim sour<TAB><ENTER> ...
3
votes
1answer
389 views

Using Pandoc with vim keybindings

I am trying to define a keymapping in vimrc to compile my markdown file with Pandoc. So I am using this: autocmd FileType markdown nmap <F9> :!pandoc % -o %:r.pdf <cr> But, in markdown ...
0
votes
1answer
110 views

how to set filetype after session restored with vim-session plugin

I used exvim as session manager, it uses a project file with extension .exvim. The session is auto-loaded when double click the .exvim, and auto-saved on exit. But there're bugs and the dev is ...
2
votes
0answers
285 views

Vim not recognizing markdown and tex files

Here is a sample of my .vimrc, that doesn't do a thing (the autocmd does not work) when I open a .md or .tex file, but works fine for .py files: augroup filetype_python autocmd FileType python ...
1
vote
1answer
772 views

Mardown files always have vimwiki filetype (vimwiki plugin)

Here is the relevant content of my .vimrc let g:vimwiki_global_ext=0 let g:vimwiki_list = [{'path': 'C:\Users\<USER>\vimwiki', \ 'syntax': 'markdown', 'ext': '.md'}] The ...
6
votes
1answer
583 views

Setting syntax in ftplugin

I’m trying to set the syntax of Processing files (*.pde) to java with a ftplugin. .vim/ after/ ftdetect/ pde.vim ftplugin/ processing.vim In after/ftdetect/pde.vim I ...
3
votes
1answer
2k views

What is the between 'set ft=' and 'setfiletype'?

I am using vim 8.1. When I need to change the default filetype for .s extension to gas (which by default is asm), I first look for the default command to set filetype in /usr/share/vim/vim81/filetype....
1
vote
0answers
43 views

Difference between &g:filetype and &filetype

Right now I have a python (*.py) file buffer open in a vim session. I also have the plugin startify installed. Now when I run the Ex-command: echo &g:filetype` I get startify. However, When I ...
4
votes
1answer
216 views

Why does the “rst” filetype automatically indent subsequent list items?

I've been having trouble understanding the behavior defined in GetRSTIndent() in indent/rst.vim. I'm specifically using Neovim v0.2.2, but I believe this file has not changed between Vim/Neovim. ...
3
votes
0answers
57 views

Syntax-aware line wrapping

Is there a way to make the automatic line wrapping of vim aware of the syntax of the file instead of just wrapping at the closest whitespace? I am specifically interested in Python but I guess it ...
0
votes
1answer
51 views

Disabling indentation for filenames without suffix

VIM's Wikia documentation states that you can disable indentation for certain filestypes by inserting the line let b:did_indent = 1 in the file ~/.vim/indent/<filetype>.vim where <filetype&...
0
votes
2answers
55 views

Unable to detect filetype which is set forcefully inside a custom plugin

I have following line in my vimrc- autocmd BufRead,BufNewFile *.COB,*.PCO set filetype=cobol "force filetype as cobol for .COB and .PCO files And I have put below lines in my custom plugin at the ...
2
votes
3answers
323 views

Vim can't detect if a file is vim file type by commenting a file with vim:ft=vim

It used to work by adding following line into a file even it has no suffix .vim, my vim version is v8.0.1500, on OS X 10.13.3 " vim:ft=vim UPDATE: I tried adding following two lines to $MYVIMRC, ...
1
vote
1answer
97 views

formatoptions for hybrid (short markup + long paragraphs) content

I am trying to write my PhD thesis in vim using LaTeX So the documents will have two distinct types of content - markups that are relatively short, and paragraph text that is rather long. \begin{...
0
votes
2answers
57 views

Scons files not recognised as Python but as conf

Neovim assigns a file type of "conf" to SConscruct and SConscript files -- aka the scons configuration scripts. This is wrong. It should be Python. I tried adding: au BufNewFile,BufRead SCons* setf ...
3
votes
1answer
701 views

Vim never shows line number for Python files even though I have `.vimrc`

I found it strange that I can never have Vim show line number automatically for .py files, even if I have this as my ~/.vimrc set background=dark autocmd FileType py,c set number Strangely enough, ...
0
votes
1answer
2k views

Why files in `~/.config/nvim/after/ftplugin/` are not taken into acount?

My neovim doesn't load file type plugins when loading a ruby/eruby file. Here is the corresponding configuration files: for f in ~/.config/nvim/after/ftplugin/* ; do echo "# $f" ; cat $f; done # /...
2
votes
1answer
575 views

Set formatoptions for a specific file

In my ftplugin/plaintext.vim script, I have the formatoptions set for editing mostly prose: setlocal formatoptions=tcroqan1j However, in very specific instances -- particularly, Python's idiomatic ...
1
vote
2answers
152 views

Tab completion for filetypes in the commandline

If I want to set the filetype manually in vim, I would like to tab complete filetypes vim recognizes. However, right now vim just inserts a literal ^I :set ft=markd^I Is this possible?
1
vote
2answers
373 views

Are commands in filetype plugins rerun every time the buffer is loaded?

Every time I switch back and forth between two buffers, vim tries to re-load some file specific commands. The error message is E174: Command already exists: add ! to replace it` I am using ...
1
vote
1answer
1k views

How to create a new vim filetype?

I have html settings set up in my ~/.vim/ftplugin/html.vim file. I would like these settings to apply to Rhtml files as well. I made a symbolic link with ln -s ~/.vim/ftplugin/html.vim ~/.vim/...
1
vote
0answers
193 views

in-line math equation rendering/preview for macvim/vim for filetypes other than RMarkdown

I recently installed vim-rmarkdown package, and found that the package allows me to see the rendered math equation in macvim, and when move cursor over, the line will render back to latex equation ...
6
votes
1answer
3k views

Why is “set noexpandtab” in my ~/.vimrc ignored when I open a file? [duplicate]

I'm using Mac OS X 10.12 and I have set noexpandtab in my ~/.vimrc There are 2 different behaviors : $ vim file.py If run Vim (8.0) to open one file and type :set expandtab?, it says expandtab $ ...
0
votes
2answers
344 views

Vi/Vim 8 on debian stretch : filetype “bindzone” not loaded automatically

When opening a bind zone file, I have to type by hand :set ft=bindzone to get syntax highlighting. It's not set automatically on load. On another hand others filetypes (such as php, perl or kind) are ...
0
votes
1answer
81 views

Open One File-type per Tab

In vim you can open all files in present directory with vim *. All of a specific file type in directory with vim *.py. Recursively we use vim **/* and vim **/*.py. To open all files in tabs vim -p *...
0
votes
1answer
383 views

How to correctly indent when beginning a new line below the cursor ('o')? [duplicate]

Screenshots My problem I am working on a js file, using eslint as my linter with the ale plugin, configured using the airbnb standard which mandates 2 space indentation. When I open a new line by ...