1

I have the following setting in my vimrc

autocmd FileType * setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab

This is just so that every file I open looks consistent.

I also have another setting in after\ftplugin\make.vim

setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab

It looks like when I open makefile settings in make.vim are triggered first and that settings in vimrc are triggered last. Is there a way to make make.vim settings to be triggered last?

Any help is appreciated.

flashburn
  • 689
  • 6
  • 17
  • Why not just do set tabstop=2 softtabstop=2 shiftwidth=2? That will apply for all filetypes when put in your vimrc, unless an ftplugin overrides it. – EvergreenTree Jul 17 '15 at 16:01
  • Looks like I forgot to add expandtab to the original code. I've just done the edit. That is what my concern. Expand the tabs in every file except when it is make. – flashburn Jul 17 '15 at 16:11
  • As @EvergreenTree suggested, just put set expandtab in your vimrc and do not put setlocal expandtab in your FileType autocommand. – garyjohn Jul 17 '15 at 16:36
  • @EvergreenTree Can you post an answer so I could accept it and upvote it. Your suggestion worked. – flashburn Jul 17 '15 at 18:11

1 Answers1

3

You can just directly put set tabstop=2 softtabstop=2 shiftwidth=2 in your vimrc. That way it is the default, but it can be overridden ftplugins and anything in the after directory. For more about how vim's runtime directories work, see :help 'runtimepath'. Also, this is a nice summary of what each directory does.

EvergreenTree
  • 8,180
  • 2
  • 37
  • 59