sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

Directory-specific settings : Easily have settings that apply only to files under a given directory

 script karma  Rating 27/12, Downloaded by 908    Comments, bugs, improvements  Vim wiki

created by
Tye Zdrojewski
script type
This is a very simple plugin that allows for directory tree-specific vim settings.

For example, I prefer to indent with spaces, but one of the code bases I'm working on uses TABs for indentation.  So, instead of mucking with settings and going back and forth, I just create a file called ".vimdir" at the top of that tree and put in some code like this:

setlocal noexpandtab

And that's it!  Every file I edit under that directory will use that setting!

For every file edited, it searches upward from that file's directory for a file named '.vimdir' and sources it.  So, any arbitrary code can be put into the .vimdir file.  But you should take care to ensure that the code applies only to that file and doesn't have any global side-effects.  So, for example, always use 'setlocal'.

This plugin is very similar to vimscript #441.
install details
Place in .vim/plugin.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
dirsettings.vim 1.0 2007-04-15 7.0 Tye Zdrojewski Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo