1

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?

4
  • 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. Commented Oct 19, 2012 at 22:45
  • 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. Commented Oct 19, 2012 at 22:51
  • Do you really work with the hundreds of languages supported by Vim? Commented Oct 20, 2012 at 6:25
  • I don't know about hundreds, but I'm running into more of them every few days. ruby, go, vala, html, perl, lisp... Commented Oct 20, 2012 at 18:16

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

This is probably what I'll end up doing. I looked through the whole list of ftplugins, and almost all of them are structured syntaxes where the 't' option doesn't make sense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.