]> git.rmz.io Git - dotfiles.git/commitdiff
vim: add more config bindings (ftplugin,syntax,indent)
authorSamir Benmendil <samir.benmendil@gmail.com>
Sun, 19 Apr 2015 01:47:10 +0000 (02:47 +0100)
committerSamir Benmendil <samir.benmendil@gmail.com>
Sun, 19 Apr 2015 01:47:10 +0000 (02:47 +0100)
vim/vimrc

index d927be15bb0b802782c871412c407de457ea6501..2cdb19d88c477dd9ea177477e9c527d25e1e73e6 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -353,9 +353,6 @@ cnoremap <C-L>   <Right>
 " close all folds open fold in cursor
 nnoremap zx zMzxzt
 
-" edit vimrc in new tab
-nmap <leader>ev :tabedit $MYVIMRC<CR>:lcd %:p:h<CR>
-
 map <F1> :ls<CR>:b<space>
 
 nnoremap <C-L> <C-W>w
@@ -576,6 +573,28 @@ if !exists(":DiffOrig")
                   \ | wincmd p | diffthis
 endif
 
+" edit configs  {{{2
+function! EditConfig(what)
+    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!"
+    elseif empty(&filetype)
+        echoe 'filetype is empty!'
+    else
+        let l:file = l:dir.'/'.a:what.'/'.&filetype.'.vim'
+    endif
+
+    execute ':vsplit '.file
+    execute ':lcd %:p:h'
+endf
+nmap <leader>ev :call EditConfig('vimrc')<CR>
+nmap <leader>ef :call EditConfig('ftplugin')<CR>
+nmap <leader>es :call EditConfig('syntax')<CR>
+nmap <leader>ei :call EditConfig('indent')<CR>
+nmap <leader>eu :UltiSnipsEdit<CR>
+
 " spell check {{{2
 " http://tex.stackexchange.com/a/52932
 let g:myLangList=["en_gb","en_us","de","fr"]