From e821da8910e18a767c3bb8d788b8b38ba0bd0c0f Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Sun, 21 May 2023 10:35:01 +0100 Subject: [PATCH] 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. --- vim/vimrc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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') -- 2.48.1