Last active
October 17, 2015 18:44
-
-
Save ffleming/252174ea4815c2544ccd to your computer and use it in GitHub Desktop.
Load partials in Vimscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Name your partials here. We'll look in e.g. ~/.vimrc.bundles, ~/.vimrc.keymaps, etc | |
" Order matters! | |
function! SourceFiles() | |
return ['bundles', 'functions', 'sets', 'aesthetics', 'keymaps', 'autocommands'] | |
endfunction | |
" Looks in e.g. ~/.vimrc.bundles | |
for file in map(SourceFiles(), '"~/.vimrc." . (v:val)') | |
if filereadable(expand(file)) | |
exec('source ' . file) | |
else | |
echoerr(string(file) . ' not readable but present in SourceFiles()') | |
endif | |
endfor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment