Skip to content

Commit

Permalink
follow suggestion offering a command doing the same as the autocomman…
Browse files Browse the repository at this point in the history
…d does
  • Loading branch information
MarcWeber committed Sep 18, 2012
1 parent 15d835c commit c06fc6e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugin/localvimrc.vim
Expand Up @@ -69,7 +69,13 @@ fun! LVRRecurseUp(cache, dir, names)
endf

" find and source files on vim startup:
call LVRWithCache('LVRRecurseUp', [getcwd(), s:c.names] )
command! SourceLocalVimrc call LVRWithCache('LVRRecurseUp', [getcwd(), s:c.names] )
command! SourceLocalVimrcOnce
\ if s:c.resource_on_cwd_change && s:last_cwd != getcwd()
\ | call LVRWithCache('LVRRecurseUp', [getcwd(), s:c.names] )
\ | endif

SourceLocalVimrcOnce

" if its you writing a file update hash automatically
fun! LVRUpdateCache(cache)
Expand All @@ -87,9 +93,6 @@ augroup LOCAL_VIMRC
" directory - so this is only an approximation to what people might expect.
" Idle events and the like would be an alternative
if ! &autochdir
autocmd BufNewFile,BufRead *
\ if s:c.resource_on_cwd_change && s:last_cwd != getcwd()
\ | call LVRWithCache('LVRRecurseUp', [getcwd(), s:c.names] )
\ | endif
autocmd BufNewFile,BufRead * SourceLocalVimrcOnce
endif
augroup end

0 comments on commit c06fc6e

Please sign in to comment.