1
votes

My system has some default vim settings that make no sense to use on programming language files. I'd like to change my formatoptions setting for any buffer with a programming language filetype.

I had been adding an autocmd to my .vimrc for each file extension:

au FileType python,c,cpp,java setlocal formatoptions=crql

But it's getting annoying to maintain this list. How can I configure settings for all programming language filetypes (c, cpp, python, java...) and possibly all structured syntaxes (xml, yaml, cfg, diff...), but not for miscellaneous filetypes like gitcommit and no filetype? Do I need to maintain my own blacklist?

1
Do you have any conception of how many languages and structured file types there are? How sure are you that they can be programmatically recognized? Mind you, vim won't support them all, but I bet the list it does support has room for some ambiguity. - dmckee --- ex-moderator kitten
I don't need to recognize every programming language, I just want every programming language vim is already configured with a filetype for to have certain settings. - Mu Mind
Do you really work with the hundreds of languages supported by Vim? - romainl
I don't know about hundreds, but I'm running into more of them every few days. ruby, go, vala, html, perl, lisp... - Mu Mind

1 Answers

2
votes

You might be better off turning on for everything, then selectively turning them off for the filetype's where it's a problem.