sponsor Vim development Vim logo Vim Book Ad

local_vimrc.vim : Load local vimrs's from $HOME to the current directory

 script karma  Rating 17/5, Downloaded by 866    Comments, bugs, improvements  Vim wiki

created by
Luc Hermitte
 
script type
utility
 
description
Note: this plugin is maintained on googlecode. The last version is available at: http://code.google.com/p/lh-vim/source/browse/misc/trunk/plugin/local_vimrc.vim

---------------------------------

This plugin recursivelly sources the _vimrc_local.vim files present from $HOME to the directory of the current buffer every time we change buffer.

Example: current dir is ~/a/b/c. Files are sourced in this order:
~/_vimrc_local.vim, then ~/a/_vimrc_local.vim, ~/a/b/_vimrc_local.vim, and finally ~/a/b/c/_vimrc_local.vim

No messages issued if some of _vimrc_local.vim does not exist.
 
install details
0- Set g:local_vimrc in your .vimrc if you wish to use filenames other than '_vimrc_local.vim'
a- Drop this plugin into a {rtp}/plugin/ directory
b- Define _vimrc_local.vim files into your directories

   Ideally, each foo/bar/_vimrc_local.vim should be defined the same way as a ftplugin, i.e.:

:::: foo/bar/_vimrc_local.vim:::
" Global stuff that needs to be updated/override
let g:bar = 'bar'  " YES! This is a global variable!

" Local stuff that needs to be defined once for each buffer
if exists('b:foo_bar_local_vimrc') | finish | endif
let b:foo_bar_local_vimrc = 1
setlocal xxx
nnoremap <buffer> foo :call <sid>s:Foo()<cr>
let b:foo = 'foo'

" Global stuff that needs to be defined once only => functions
if exists('g:foo_bar_local_vimrc') | finish | endif
let g:foo_bar_local_vimrc = 1
function s:Foo()
  ...
endfunction
::::::::::::::
 

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
local_vimrc.vim 1.3 2003-08-06 6.0 Luc Hermitte Initial upload
ip used for rating: 54.242.200.172

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