sponsor Vim development Vim logo Vim Book Ad

localvimrc : load subdirectory specific vimrc files

 script karma  Rating 205/74, Downloaded by 3293    Comments, bugs, improvements  Vim wiki

created by
Markus Braun
 
script type
utility
 
description
Sometimes, when you work on different projects, you have the problem, that they use different indentation, tab expansion and so on. You need vimrc for each project that overrides your prefered settings from ~/.vimrc

This plugin searches for local vimrc files in the file system tree of the currently opened file. By default it searches for all ".lvimrc" files from the file's directory up to the root directory and loads them in reverse order. The filename and amount of loaded files are customizable through global variables.

For security reasons it the plugin asks for confirmation before loading a local vimrc file and loads it using :sandbox command. The plugin asks once per session and local vimrc before loading it, if the file didn't change since previous loading.

It is possible to define a whitelist and a blacklist of local vimrc files that are loaded or ignored unconditionally.

If you think this plugin could be improved, fork on GitHub and send a pull request or just tell me your ideas.

GitHub: https://github.com/embear/vim-localvimrc
Bitbucket: https://bitbucket.org/embear/localvimrc
 
install details
localvimrc is now distributed as a vimball (see :help vimball)

vim localvimrc.vba
:so %
:q

and that's all!
 

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
localvimrc.vba 2.3.0 2014-02-06 7.2 Markus Braun - private persistence file to enable persistence over concurrent vim instances.
- add convenience variables g:localvimrc_sourced_once and g:localvimrc_sourced_once_for_file.
localvimrc.vba 2.2.0 2013-11-09 7.2 Markus Braun - remove redraw calls for better performance and fixing a bug on windows.
- load local vimrc on event BufWinEnter to fix a bug with window local
  settings.
- add g:localvimrc_reverse to change order of sourcing local vimrc files.
- add convenience variables g:localvimrc_file, g:localvimrc_file_dir,
  g:localvimrc_script and g:localvimrc_script_dir.
localvimrc.vba 2.1.0 2012-09-25 7.2 Markus Braun - add possibility to make decisions persistent
- use full file path when storing decisions
localvimrc.vba 2.0.0 2012-04-05 7.2 Markus Braun - added g:localvimrc_whitelist and g:localvimrc_blacklist settings.
- ask only once per session and local vimrc before loading it, if it didn't change.
localvimrc.vim 2758 2009-05-11 7.0 Markus Braun - source .lvimrc in a sandbox to better maintain security, configurable using g:localvimrc_sandbox
- ask user before sourcing any local vimrc file, configurable using g:localvimrc_ask  
localvimrc.vim 1870 2007-09-28 7.0 Markus Braun - new configuration variable g:localvimrc_name to change filename
- new configuration variable g:localvimrc_count to limit number of loaded files
localvimrc.vim 1613 2007-04-05 7.0 Markus Braun - switched to arrays in vim 7
- escape file/path names correctly
localvimrc.vim 1.2 2002-10-09 6.0 Markus Braun Initial upload
ip used for rating: 50.19.206.49

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