I want to reorganization my vim
directory to be like this:
- dotfiles
|- vim
| |- config
| | |- global
| | | |- basic.vim
| | | |...
| | |- plugins
| | | |- ctrl-p.vim
| | | |...
| | |- functions
| | | |...
| | |...
| |- bootstrap.vimrc
in $HOME/.vimrc
:
if isdirectory(expand('$HOME/dotfiles/vim'))
source $HOME/dotfiles/vim/bootstrap.vimrc
endif
My question is, how to include all Vim config files in global
, plugins
, functions
folder?
I find a function like this:
function! SourceConfig()
let file_list = split(globpath('$HOME/dotfiles/vim/', '.vim'), '\n')
for file in file_list
execute('source '.file)
endfor
endfunction
call sourceConfig()
But I want to according to the specified load folder, how to modify the func, make the globpath
change to be an array
or something, like below.
let $path=[global, plugins, functions] // this will be source files in turn.
function! SourceConfig()
let file_list = split(globpath($path, '.vim'), '\n')
for file in file_list
execute('source '.file)
endfor
endfunction
call sourceConfig()
Use before/plugin and after/plugin?