X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/b01e4c09f16e634eb3f6ebbddcb72a38fac37bf8..1b0f60b7d421f9a80c85a09e3974eb7f93de508a:/vim/vimrc diff --git a/vim/vimrc b/vim/vimrc index e8a5192..681d32a 100644 --- 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,14 @@ 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' +Plugin 'vim-scripts/yankring.vim' " remove entries first set runtimepath -=$HOME/.vim @@ -164,19 +170,30 @@ set diffopt=filler,vertical " reading and writing files {{{2 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// +set backupdir=$XDG_CACHE_HOME/vim/backup// + +set backupskip+=.netrc " skip netrc +set backupskip+=/dev/shm/pass* " skip passwordstore files set undofile " persistent undo history -set undodir=$XDG_CACHE_HOME/vim// +set undodir=$XDG_CACHE_HOME/vim/undo// + +augroup undoskip + au! + au BufWritePre .netrc setlocal noundofile + au BufWritePre /dev/shm/pass* setlocal noundofile + au BufWritePre /tmp/* setlocal noundofile +augroup END set autowrite " automatically write a file when leaving a modified buffer set autoread " automatically read a file that has been modified " the swap file {{{2 set noswapfile -set directory=$XDG_CACHE_HOME/vim// +set directory=$XDG_CACHE_HOME/vim/swap// " command line editing {{{2 set history=5000 " how many command lines are remembered @@ -197,7 +214,7 @@ set wildignore+=*.orig " Merge resolution files set virtualedit=block " let cursor move past last char in mode set viminfo='100,<50,s10,h,n$XDG_CACHE_HOME/vim/viminfo " viminfo defaults but save file in .cache -set viewdir=$XDG_CACHE_HOME/vim +set viewdir=$XDG_CACHE_HOME/vim/view// " autocmds {{{1 " Resize splits when the window is resized {{{2 @@ -230,12 +247,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 and / to be @@ -334,7 +345,7 @@ cnoremap cnoremap " close all folds open fold in cursor -nnoremap zx zMzxzz15 +nnoremap zx zMzxzt " edit vimrc in new tab nmap ev :tabedit $MYVIMRC:lcd %:p:h @@ -392,8 +403,19 @@ let g:airline_detect_whitespace=2 let g:airline#extensions#tabline#enabled = 1 let g:airline_powerline_fonts = 1 -" Gundo {{{2 -nnoremap :GundoToggle +" checkattach {{{2 +let g:checkattach_filebrowser = 'ranger' + +" delimitmate {{{2 +let delimitMate_expand_cr = 2 +let g:delimitMate_expand_space = 1 + +" fswitch {{{2 +nnoremap ff :FSHere +nnoremap fl :FSRight +nnoremap fh :FSLeft +nnoremap fL :FSSplitRight +nnoremap fH :FSSplitLeft " fugitive {{{2 nmap dd :tab split \| Gdiff \| wincmd h @@ -404,6 +426,17 @@ nnoremap gs :Gstatus nnoremap gd :Gdiff nnoremap gc :tab Gcommit -v nnoremap ga :Gwrite +nnoremap gb :Gblame + +" Gundo {{{2 +nnoremap :GundoToggle + +" indent-guides {{{2 +let g:indent_guides_default_mapping = 0 +let g:indent_guides_guide_size = 1 +nmap cog IndentGuidesToggle +nmap [og IndentGuidesEnable +nmap ]og IndentGuidesDisable " NERDTree {{{2 " open/close NERDTree with \e @@ -414,6 +447,14 @@ 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_rope = 0 +let g:pymode_folding = 1 +let g:pymode_lint_ignore = "E221,E266,E501" +let g:pymode_syntax_space_errors = 0 " don't bother me when I'm typing + " synastic {{{2 let g:syntastic_enable_highlighting = 0 let g:syntastic_error_symbol='E' @@ -437,7 +478,22 @@ 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 = "" +let g:UltiSnipsJumpForwardTrigger = "" +let g:UltiSnipsJumpBackwardTrigger = "" + +" yankring {{{2 +nnoremap p :YRShow +let g:yankring_history_dir = expand('$XDG_CACHE_HOME/vim') +let g:yankring_replace_n_pkey = '' +let g:yankring_replace_n_nkey = '' + +" map Y to y$ for the yank ring +function! YRRunAfterMaps() + nnoremap Y :YRYankCount 'y$' +endfunction " youcompleteme {{{2 let g:ycm_extra_conf_globlist = ['~/src/*','/mnt/data/src/*'] @@ -448,6 +504,10 @@ let g:ycm_autoclose_preview_window_after_insertion = 1 "let g:ycm_extra_conf_vim_data = ['%:p'] nnoremap jd :YcmCompleter GoTo +" vim-easy-align {{{2 +" start interactive EasyAlign in visual mode +vmap (EasyAlign) + " vim-json {{{2 let g:vim_json_syntax_conceal = 0 @@ -497,19 +557,3 @@ nnoremap s :call ToggleSpell() nnoremap S :call SwitchSpell() " fix spelling with first choice nnoremap 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 n :call g:ToggleNumber() -nnoremap N :setlocal relativenumber!