Skip to content

Instantly share code, notes, and snippets.

@mattsacks
Created January 8, 2012 22:49
Show Gist options
  • Save mattsacks/1579990 to your computer and use it in GitHub Desktop.
Save mattsacks/1579990 to your computer and use it in GitHub Desktop.
" if the current buffer has a different working directory than the one when
" Vim starts, source the .localvimrc
augroup Localvimrc
autocmd!
autocmd VimEnter * if filereadable('.localvimrc')
\| so .localvimrc
\| endif
\| let g:localvimrc_directory = getcwd()
autocmd BufEnter,BufNewFile * if getcwd() != g:localvimrc_directory && filereadable('.localvimrc')
\| so .localvimrc
\| endif
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment