]> git.rmz.io Git - dotfiles.git/blobdiff - vim/vimrc
nvim: do not override gr keymap
[dotfiles.git] / vim / vimrc
index 7e493fcd1ba16414f60b090c9ff498880c2da85d..a600c8e518836638273b0dafb1825c948d4c5a5d 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -911,21 +911,21 @@ nnoremap <silent> gs :<C-U>set operatorfunc=SortLinesOpFunc<CR>g@
 vnoremap <silent> gs :sort<cr>
 
 " edit configs  {{{2
+" TODO: populate location list with both .vim and .lua files
+" TODO: create file if it doesn't exist in nvim or vim rtps
 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!"
+    if a:what == 'vimrc' || a:what == 'init.lua'
+        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>en :call EditConfig('init.lua')<CR>
 nmap <leader>ev :call EditConfig('vimrc')<CR>
 nmap <leader>ef :call EditConfig('ftplugin')<CR>
 nmap <leader>es :call EditConfig('syntax')<CR>