" edit configs {{{2
function! EditConfig(what, ext = '.vim')
- let l:dir = split(&runtimepath,',')[0]
if a:what == 'vimrc'
- let l:file = expand($MYVIMRC)
- elseif ! isdirectory(globpath(l:dir, a:what))
- echoe a:what." is not valid!"
+ let l:file = a:what
elseif empty(&filetype)
echoe 'filetype is empty!'
+ return
else
- let l:file = l:dir.'/'.a:what.'/'.&filetype.a:ext
+ let l:file = a:what.'/'.&filetype.a:ext
endif
- execute ':vsplit '.file
- execute ':lcd %:p:h'
+ execute ':Vvsplit! '.file
endf
nmap <leader>ev :call EditConfig('vimrc')<CR>
nmap <leader>ef :call EditConfig('ftplugin')<CR>