Skip to content

Instantly share code, notes, and snippets.

@ffleming
Last active October 17, 2015 18:44
Show Gist options
  • Save ffleming/252174ea4815c2544ccd to your computer and use it in GitHub Desktop.
Save ffleming/252174ea4815c2544ccd to your computer and use it in GitHub Desktop.
Load partials in Vimscript
" 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