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
" 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