Adds a function to local-vimrc plugin to load .vimrc.local at startup.

This commit is contained in:
Vahagn Khachatryan
2016-04-08 13:43:07 -04:00
parent 3a585a6412
commit 2e69a93b14

View File

@@ -26,14 +26,22 @@ let g:loaded_local_vimrc=1
" Section: Event group setup " Section: Event group setup
" Act when creating or loading a file " Act when creating or loading a file
augroup LocalVimrc augroup LocalVimrc
au BufNewFile,BufRead * call s:LoadConfig() au BufNewFile,BufRead * call s:LocalVimrcLoadForFile()
augroup END augroup END
" Function: LoadConfig() " Function: LoadConfig()
" "
" If the file .vimrc exists in the root of a git project - load it " If the file .vimrc exists in the path - load it
function s:LoadConfig() function s:LocalVimrcLoadForFile()
let l:path = fnameescape(expand("%:p:h")) 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) if empty(l:path)
return return
endif endif