]> git.rmz.io Git - dotfiles.git/blobdiff - vim/vimrc
Merge branch 'master' of tardis:dotfiles
[dotfiles.git] / vim / vimrc
index 34da981aca40b3ae32ecda8e6d97818b8967b363..14ebec3c88ced741c33610555cc35bf75507eb83 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -14,18 +14,20 @@ call vundle#rc('$XDG_DATA_HOME/vim')
 
 Plugin 'gmarik/vundle'
 
+Plugin 'airblade/vim-gitgutter'
 Plugin 'bling/vim-airline'
 Plugin 'elzr/vim-json'
-Plugin 'rking/ag.vim'
 Plugin 'http://git.code.sf.net/p/vim-latex/vim-latex'
+Plugin 'junegunn/vim-easy-align'
 Plugin 'kien/ctrlp.vim'
 Plugin 'kshenoy/vim-signature'
 Plugin 'majutsushi/tagbar'
+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'
@@ -41,10 +43,13 @@ Plugin 'derekwyatt/vim-fswitch'
 " Plugin 'jalcine/cmake.vim'
 " Plugin 'powerman/vim-plugin-viewdoc'
 
-Plugin 'airblade/vim-gitgutter'
-Plugin 'Raimondi/delimitMate'
-Plugin 'SirVer/ultisnips'
-Plugin 'Lokaltog/vim-easymotion'
+" endwise needs to be after delimitmate
+Plugin 'raimondi/delimitmate'
+Plugin 'tpope/vim-endwise'
+Plugin 'lokaltog/vim-easymotion'
+Plugin 'chrisbra/checkattach'
+Plugin 'klen/python-mode'
+Plugin 'nathanaelkane/vim-indent-guides'
 
 " remove entries first
 set runtimepath -=$HOME/.vim
@@ -158,8 +163,12 @@ set foldlevelstart=0            " value for 'foldlevel' when starting to edit a
 " save and restore folds
 set viewoptions=folds,cursor    " don't save local options
 
+" diff mode {{{2
+set diffopt=filler,vertical
+
 " reading and writing files {{{2
-set nomodeline                  " don't read modelines
+set modeline                    " read modelines
+set modelines=2                 " only check first/last 2 lines
 set writebackup                 " write a backup file before overwriting a file
 set backup                      " keep a backup after owerwriting a file
 set backupdir=$XDG_CACHE_HOME/vim//
@@ -226,12 +235,6 @@ augroup cursor_pos
                 \ endif
 augroup END
 
-" auto source vimrc when saved {{{2
-augroup source_vimrc
-    au!
-    autocmd bufwritepost vimrc source $MYVIMRC
-augroup END
-
 " bindings {{{1
 
 " allow both <space> and / to be <leader>
@@ -307,6 +310,10 @@ inoremap <c-e> <esc>A
 cnoremap <c-a> <home>
 cnoremap <c-e> <end>
 
+" proper movement when lines are wrapped
+noremap <expr> j (v:count == 0 ? 'gj' : 'j')
+noremap <expr> k (v:count == 0 ? 'gk' : 'k')
+
 " disable arrows
 noremap  <Up>    <NOP>
 noremap  <Down>  <NOP>
@@ -326,10 +333,10 @@ cnoremap <C-H>   <Left>
 cnoremap <C-L>   <Right>
 
 " close all folds open fold in cursor
-nnoremap zx zMzxzz15<C-e>
+nnoremap zx zMzxzt
 
 " edit vimrc in new tab
-nmap <leader>ev :tabedit $MYVIMRC<CR>
+nmap <leader>ev :tabedit $MYVIMRC<CR>:lcd %:p:h<CR>
 
 map <F1> :ls<CR>:b<space>
 
@@ -384,8 +391,19 @@ let g:airline_detect_whitespace=2
 let g:airline#extensions#tabline#enabled = 1
 let g:airline_powerline_fonts = 1
 
-" Gundo {{{2
-nnoremap <F7> :GundoToggle<CR>
+" checkattach {{{2
+let g:checkattach_filebrowser = 'ranger'
+
+" delimitmate {{{2
+let delimitMate_expand_cr = 2
+let g:delimitMate_expand_space = 1
+
+" fswitch {{{2
+nnoremap <silent> <Leader>ff :FSHere<CR>
+nnoremap <silent> <Leader>fl :FSRight<CR>
+nnoremap <silent> <Leader>fh :FSLeft<CR>
+nnoremap <silent> <Leader>fL :FSSplitRight<CR>
+nnoremap <silent> <Leader>fH :FSSplitLeft<CR>
 
 " fugitive {{{2
 nmap <silent> <leader>dd :tab split \| Gdiff \| wincmd h<CR>
@@ -395,7 +413,18 @@ autocmd BufReadPost fugitive://* set bufhidden=delete
 nnoremap <silent> <leader>gs :Gstatus<CR>
 nnoremap <silent> <leader>gd :Gdiff<CR>
 nnoremap <silent> <leader>gc :tab Gcommit -v<CR>
-nnoremap <silent> <leader>gw :Gwrite<cr>
+nnoremap <silent> <leader>ga :Gwrite<cr>
+nnoremap <silent> <leader>gb :Gblame<cr>
+
+" Gundo {{{2
+nnoremap <F7> :GundoToggle<CR>
+
+" indent-guides {{{2
+let g:indent_guides_default_mapping = 0
+let g:indent_guides_guide_size = 1
+nmap <silent> cog <Plug>IndentGuidesToggle
+nmap <silent> [og <Plug>IndentGuidesEnable
+nmap <silent> ]og <Plug>IndentGuidesDisable
 
 " NERDTree {{{2
 " open/close NERDTree with \e
@@ -406,6 +435,11 @@ let NERDTreeMapActivateNode='l'
 " close vim if only NERDTree is open
 autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
 
+" python-mode {{{2
+
+let g:pymode_rope_completion = 0
+let g:pymode_folding = 1
+
 " synastic {{{2
 let g:syntastic_enable_highlighting = 0
 let g:syntastic_error_symbol='E'
@@ -429,16 +463,25 @@ let g:tagbar_iconchars = ['+', '-']
 
 " UltiSnips {{{2
 let g:UltiSnipsEditSplit = 'vertical'
-let g:UltiSnipsSnippetsDir = "$XDG_CONFIG_HOME/vim/ultisnips"
+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>"
 
 " youcompleteme {{{2
 let g:ycm_extra_conf_globlist = ['~/src/*','/mnt/data/src/*']
 let g:ycm_global_ycm_extra_conf = expand('$XDG_CONFIG_HOME/vim/ycm_extra_conf.py')
+let g:ycm_extra_conf_vim_data = ['getcwd()']
 let g:ycm_add_preview_to_completeopt = 1
 let g:ycm_autoclose_preview_window_after_insertion = 1
 "let g:ycm_extra_conf_vim_data = ['%:p']
 nnoremap <leader>jd :YcmCompleter GoTo<CR>
 
+" vim-easy-align {{{2
+" start interactive EasyAlign in visual mode
+vmap <Enter> <Plug>(EasyAlign)
+
 " vim-json {{{2
 let g:vim_json_syntax_conceal = 0
 
@@ -488,20 +531,3 @@ nnoremap <silent> <Leader>s :call ToggleSpell()<CR>
 nnoremap <silent> <Leader>S :call SwitchSpell()<CR>
 " fix spelling with first choice
 nnoremap <Leader>f 1z=
-
-" Toggle line numbers {{{2
-function! g:ToggleNumber()
-    if !exists("b:relanum")
-        let b:relanum=1
-    endif
-    if &l:number
-        let b:relanum = &relativenumber
-        setlocal nonumber norelativenumber
-    else
-        let &l:relativenumber = b:relanum
-        setlocal number
-    endif
-endfunction
-nnoremap <silent><leader>n :call g:ToggleNumber()<cr>
-nnoremap <silent><leader>N :setlocal relativenumber!<cr>
-