diff --git a/.gitignore b/.gitignore index 47af852..45aadfa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ +vim/.netrwhist vim/autoload/plug.vim +vim/backup/*~ vim/plugged/* vim/rc/*.local.rc.vim -vim/tmp/*.swp vim/tmp/*.swo -vim/.netrwhist +vim/tmp/*.swp diff --git a/vim/rc/plugins.rc.vim b/vim/rc/plugins.rc.vim index bb1968c..4219cfd 100644 --- a/vim/rc/plugins.rc.vim +++ b/vim/rc/plugins.rc.vim @@ -1,3 +1,15 @@ +function! s:smart_source_rc(name) + call s:source_rc(a:name . '.rc.vim') + call s:source_rc(a:name . '.local.rc.vim') +endfunction + +function! s:source_rc(path) + let l:f_path = fnameescape(expand('~/.vim/rc/' . a:path)) + if filereadable(l:f_path) + execute 'source' . l:f_path + endif +endfunction + " Navigation {{ Plug 'file-line' Plug 'tpope/vim-vinegar' @@ -17,7 +29,7 @@ Plug 'sandeepcr529/Buffet.vim', { 'on': 'Bufferlist' } Plug 'ctrlpvim/ctrlp.vim' -call g:source_rc('plugins/ctrlp.rc.vim') +call s:source_rc('plugins/ctrlp.rc.vim') " ag / ack {{ if executable('ag') diff --git a/vimrc b/vimrc index fe124d0..06f8ee6 100644 --- a/vimrc +++ b/vimrc @@ -7,12 +7,12 @@ if &compatible set nocompatible endif -function! g:smart_source_rc(name) - call g:source_rc(a:name . '.rc.vim') - call g:source_rc(a:name . '.local.rc.vim') +function! s:smart_source_rc(name) + call s:source_rc(a:name . '.rc.vim') + call s:source_rc(a:name . '.local.rc.vim') endfunction -function! g:source_rc(path) +function! s:source_rc(path) let l:f_path = fnameescape(expand('~/.vim/rc/' . a:path)) if filereadable(l:f_path) execute 'source' . l:f_path @@ -43,12 +43,12 @@ if empty(glob('~/.vim/autoload/plug.vim')) autocmd VimEnter * PlugInstall endif -call g:source_rc('init.rc.vim') +call s:source_rc('init.rc.vim') call plug#begin() -call g:smart_source_rc('plugins') +call s:smart_source_rc('plugins') call plug#end() -call g:smart_source_rc('edit') -call g:smart_source_rc('keymap') -call g:smart_source_rc('ui') +call s:smart_source_rc('edit') +call s:smart_source_rc('keymap') +call s:smart_source_rc('ui')