From: Samir Benmendil Date: Sun, 21 May 2023 09:35:01 +0000 (+0100) Subject: vim: use scriptease :Vvsplit to open config files X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/80e1e6396316f56a64a1772f0acafe449b87b074?ds=sidebyside vim: use scriptease :Vvsplit to open config files This works slightly differently as before in that it will not create a new file if it didn't exist. But it will work for in nvim too. --- diff --git a/vim/vimrc b/vim/vimrc index 7e493fc..a7e23ac 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -912,19 +912,16 @@ vnoremap gs :sort " 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 ev :call EditConfig('vimrc') nmap ef :call EditConfig('ftplugin')