]> git.rmz.io Git - dotfiles.git/blobdiff - vim/vimrc
weechat: update grep plugin
[dotfiles.git] / vim / vimrc
index cbcc9ac4114189b4360c9cde459149ed775bc488..77a35a33d65a086d8333c5c75bd68506e62f38b7 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -257,6 +257,7 @@ augroup END
 map <space> <leader>
 
 " make
+nnoremap <leader>r :make<cr>
 nnoremap <leader><cr> :make<cr>
 
 " unhighlight search
@@ -294,8 +295,8 @@ nnoremap <leader>i :set list!<cr>
 nnoremap U :syntax sync fromstart<cr>:AirlineRefresh<cr>:redraw!<cr>
 
 " Ranger
-nnoremap <leader>r :silent !ranger %:h<cr>:redraw!<cr>
-nnoremap <leader>R :silent !ranger<cr>:redraw!<cr>
+nnoremap <leader>r :silent !ranger %:h<cr>:redraw!<cr>
+nnoremap <leader>R :silent !ranger<cr>:redraw!<cr>
 
 " Use sane regexes.
 nnoremap / /\v
@@ -396,7 +397,7 @@ autocmd BufWinEnter *.* silent loadview
 " save with sudo
 cnoremap w!! w !sudo tee % > /dev/null
 
-" plugins {{{1
+" plugins options {{{1
 " ag {{{2
 let g:AgSmartCase = 1
 nnoremap <leader>ag yiw:Ag \12"<cr>
@@ -484,9 +485,31 @@ let g:tagbar_iconchars = ['+', '-']
 let g:UltiSnipsEditSplit = 'vertical'
 let g:UltiSnipsSnippetsDir = expand("$XDG_CONFIG_HOME/vim/ultisnips")
 let g:UltiSnipsSnippetDirectories = ["UltiSnips", "ultisnips"]
-let g:UltiSnipsExpandTrigger = "<C-L>"
-let g:UltiSnipsJumpForwardTrigger = "<C-L>"
-let g:UltiSnipsJumpBackwardTrigger = "<C-H>"
+let g:UltiSnipsExpandTrigger       = "<tab>"
+let g:UltiSnipsJumpForwardTrigger  = "<tab>"
+let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
+
+" UltiSnips completion function that tries to expand a snippet. If there's no
+" snippet for expanding, it checks for completion window and if it's shown,
+" selects first element. If there's no completion window it tries to jump to
+" next placeholder. If there's no placeholder it just returns TAB key
+" https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-15451411
+function! g:UltiSnips_Complete()
+    call UltiSnips#ExpandSnippet()
+    if g:ulti_expand_res == 0
+        if pumvisible()
+            return "\<C-n>"
+        else
+            call UltiSnips#JumpForwards()
+            if g:ulti_jump_forwards_res == 0
+               return "\<TAB>"
+            endif
+        endif
+    endif
+    return ""
+endfunction
+au InsertEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
+let g:UltiSnipsListSnippets="<c-e>"
 
 " yankring {{{2
 nnoremap <silent> <leader>p :YRShow<cr>
@@ -557,7 +580,6 @@ function! SwitchSpell()
   echo "setlocal spelllang=" g:myLangList[b:myLang]
 endfunction
 
-nnoremap <silent> <Leader>s :call ToggleSpell()<CR>
-nnoremap <silent> <Leader>S :call SwitchSpell()<CR>
+nnoremap <silent> coS :call SwitchSpell()<CR>
 " fix spelling with first choice
 nnoremap <Leader>f 1z=