I edit a lot of different file types, like .c, .cc, .S, .py, .rs, .ld, plus maybe a dozen more. And I'm constantly editing new file types, so I'm adding to this list. I have settings I want to apply equivalently to all of them, like shift width.
But, I don't want to do this to all files, since I also edit a lot of non-programming files.
It doesn't make sense to have to create a new config every time I come across a new file type, even if I have a common base file. The autocmd FileType
is no better since I still need to add more configuration to .vimrc for every file type.
Is there some equivalent of an emacs prog-mode-hook
where I can configure settings once and have them apply to all programming files?
autocmd FileType
work for you?c-mode
) inherits fromprog-mode
. It looks like you can actually inherit from multiple modes – it seems pretty neat. The closest you can get with Vim is by using dot-separated multiple filetypes (i.eset ft=prog.c
).