Adds a function to local-vimrc plugin to load .vimrc.local at startup.
This commit is contained in:
@@ -26,14 +26,22 @@ let g:loaded_local_vimrc=1
|
||||
" Section: Event group setup
|
||||
" Act when creating or loading a file
|
||||
augroup LocalVimrc
|
||||
au BufNewFile,BufRead * call s:LoadConfig()
|
||||
au BufNewFile,BufRead * call s:LocalVimrcLoadForFile()
|
||||
augroup END
|
||||
|
||||
" Function: LoadConfig()
|
||||
"
|
||||
" If the file .vimrc exists in the root of a git project - load it
|
||||
function s:LoadConfig()
|
||||
" If the file .vimrc exists in the path - load it
|
||||
function s:LocalVimrcLoadForFile()
|
||||
let l:path = fnameescape(expand("%:p:h"))
|
||||
call g:LocalVimrcLoad( l:path )
|
||||
endfunction
|
||||
|
||||
" Function: LocalVimrcLoad()
|
||||
"
|
||||
" If the file .vimrc exists in the path - load it
|
||||
function! g:LocalVimrcLoad(path)
|
||||
let l:path = a:path
|
||||
if empty(l:path)
|
||||
return
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user