Plugin 'chrisbra/checkattach'
Plugin 'klen/python-mode'
Plugin 'nathanaelkane/vim-indent-guides'
+Plugin 'vim-scripts/yankring.vim'
" remove entries first
set runtimepath -=$HOME/.vim
" 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
set virtualedit=block " let cursor move past last char in <C-V> 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
" 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:UltiSnipsJumpForwardTrigger = "<C-L>"
let g:UltiSnipsJumpBackwardTrigger = "<C-H>"
+" yankring {{{2
+nnoremap <silent> <leader>p :YRShow<cr>
+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 :<C-U>YRYankCount 'y$'<CR>
+endfunction
+
" 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')
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>