]> git.rmz.io Git - dotfiles.git/blobdiff - vim/vimrc
flexget: split usenet templates
[dotfiles.git] / vim / vimrc
index 681d32ac3e59bf58087f768bb44638dfdbf4bb17..160aba896c5f700c515433632fd3fff90a6f61ba 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -16,41 +16,46 @@ Plugin 'gmarik/vundle'
 
 Plugin 'airblade/vim-gitgutter'
 Plugin 'bling/vim-airline'
+Plugin 'derekwyatt/vim-fswitch'
 Plugin 'elzr/vim-json'
-Plugin 'http://git.code.sf.net/p/vim-latex/vim-latex'
+Plugin 'firef0x/pkgbuild.vim'
 Plugin 'junegunn/vim-easy-align'
 Plugin 'kien/ctrlp.vim'
+Plugin 'klen/python-mode'
 Plugin 'kshenoy/vim-signature'
 Plugin 'majutsushi/tagbar'
+Plugin 'raimondi/delimitmate'
 Plugin 'rking/ag.vim'
 Plugin 'scrooloose/nerdtree'
 Plugin 'scrooloose/syntastic'
-Plugin 'sirver/ultisnips'
 Plugin 'sjl/gundo.vim'
 Plugin 'tomtom/tcomment_vim'
+Plugin 'tpope/vim-endwise'
 Plugin 'tpope/vim-fugitive'
 Plugin 'tpope/vim-repeat'
 Plugin 'tpope/vim-surround'
 Plugin 'tpope/vim-unimpaired'
 Plugin 'valloric/youcompleteme'
+Plugin 'vim-scripts/yankring.vim'
+
+" snippets
+Plugin 'sirver/ultisnips'
+Plugin 'honza/vim-snippets'
 
+" ros
 Plugin 'ompugao/ros.vim'
 Plugin 'ompugao/ctrlp-ros'
 
-Plugin 'firef0x/pkgbuild.vim'
-Plugin 'derekwyatt/vim-fswitch'
 " seems to have problems right now... may be add later?
 " Plugin 'jalcine/cmake.vim'
 " Plugin 'powerman/vim-plugin-viewdoc'
 
-" endwise needs to be after delimitmate
-Plugin 'raimondi/delimitmate'
-Plugin 'tpope/vim-endwise'
-Plugin 'lokaltog/vim-easymotion'
+" find an alternative
+Plugin 'http://git.code.sf.net/p/vim-latex/vim-latex'
+" Plugin 'lokaltog/vim-easymotion'
+Plugin 'justinmk/vim-sneak'
 Plugin 'chrisbra/checkattach'
-Plugin 'klen/python-mode'
 Plugin 'nathanaelkane/vim-indent-guides'
-Plugin 'vim-scripts/yankring.vim'
 
 " remove entries first
 set runtimepath -=$HOME/.vim
@@ -253,6 +258,7 @@ augroup END
 map <space> <leader>
 
 " make
+nnoremap <leader>r :make<cr>
 nnoremap <leader><cr> :make<cr>
 
 " unhighlight search
@@ -290,8 +296,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
@@ -392,19 +398,20 @@ 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>
 vnoremap <leader>ag y:Ag \12"<cr>
 
 " airline {{{2
-let g:airline_detect_whitespace=2
+let g:airline#extensions#whitespace#enabled = 1
 let g:airline#extensions#tabline#enabled = 1
 let g:airline_powerline_fonts = 1
 
 " checkattach {{{2
 let g:checkattach_filebrowser = 'ranger'
+let g:checkattach_once = 'y'
 
 " delimitmate {{{2
 let delimitMate_expand_cr = 2
@@ -480,9 +487,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>
@@ -516,6 +545,24 @@ let g:tex_flavor='latex'
 let g:Tex_DefaultTargetFormat='pdf'
 let g:Tex_MultipleCompileFormats='pdf'
 
+" vim-sneak {{{2
+let g:sneak#streak = 1
+let g:sneak#target_labels = "aoeuisnthdpylrcgfqjkxzmwvz" " dvorak
+let g:sneak#use_ic_scs = 1  " follow 'ignorecase' and 'smartcase'
+
+" sneaky f and t
+nmap f <Plug>Sneak_f
+nmap F <Plug>Sneak_F
+xmap f <Plug>Sneak_f
+xmap F <Plug>Sneak_F
+omap f <Plug>Sneak_f
+omap F <Plug>Sneak_F
+nmap t <Plug>Sneak_t
+nmap T <Plug>Sneak_T
+xmap t <Plug>Sneak_t
+xmap T <Plug>Sneak_T
+omap t <Plug>Sneak_t
+omap T <Plug>Sneak_T
 
 " functions {{{1
 
@@ -553,7 +600,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=