Reputation: 492
What's the best way to override my ftplugin settings for one project i.e. files under a specific directory?
For example, I have setlocal tabstop=4 in my ~/.vim/ftplugin/javascript.vim because all my company's projects have this whitespace policy.
But in one personal project I want to use tabstop=2 in my .js files.
I understand I can place a custom .vimrc in that project's directory and enable vim's exrc option to make it read that .vimrc file. Is this the best way?
Upvotes: 3
Views: 1006
Reputation: 172520
I use the localrc.vim - Enable configuration file of each directory plugin for this. It not only allows sourcing of a "local .vimrc" file, but also offers filetype-specific settings for particular subdirectories (by default, the files are named .local.{filetype}.vimrc
).
Upvotes: 2
Reputation: 946
set exrc
will read a .vimrc file in the current directory, but will also read the structure under .vim directory. So you can add
myproject/.vim/after/ftplugin/javascript.vim
to your project; It'll work as if this file were on your home dir when you open files from myproject
dir.
Upvotes: 4