diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-28 21:27:51 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-28 21:27:51 +1300 |
commit | 8bbfbf3365159c670b3a634f2fbb11af0ca181d0 (patch) | |
tree | d0528afe51681d4c7fdc4af769fce55fd1720cfa | |
parent | Move backup .vimrc config into subfile (diff) | |
download | dotfiles-8bbfbf3365159c670b3a634f2fbb11af0ca181d0.tar.gz dotfiles-8bbfbf3365159c670b3a634f2fbb11af0ca181d0.zip |
Move undo .vimrc config into subfile
Interestingly, this does not seem to work, and this configuration
doesn't get loaded; I suspect the :runtime line is not quite right.
-rw-r--r-- | vim/config/undo.vim | 32 | ||||
-rw-r--r-- | vim/vimrc | 33 |
2 files changed, 32 insertions, 33 deletions
diff --git a/vim/config/undo.vim b/vim/config/undo.vim new file mode 100644 index 00000000..3df06d80 --- /dev/null +++ b/vim/config/undo.vim @@ -0,0 +1,32 @@ +" Rebind Ctrl-C in insert mode to undo the current insert operation +inoremap <C-c> <C-c>u + +" Keep screeds of undo history +set undolevels=2000 + +" Keep undo history in a separate file if the feature is available, we're on +" Unix, and not using sudo(8); this goes really well with undo visualization +" plugins like Gundo or Undotree. +if !strlen($SUDO_USER) && has('unix') && has('persistent_undo') + + " Keep per-file undo history in ~/.vim/undo; the double-slash at the end + " of the directory prods Vim into keeping the full path to the file in its + " undo filename to avoid collisions; the same thing works for swap files + set undofile + set undodir^=~/.vim/undo// + + " Create the ~/.vim/undo directory if necessary and possible + if !isdirectory($HOME . '/.vim/undo') && exists('*mkdir') + call mkdir($HOME . '/.vim/undo', 'p', 0700) + endif + + " Don't track changes to sensitive files + if has('autocmd') + augroup undoskip + autocmd! + silent! autocmd BufWritePre + \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* + \ setlocal noundofile + augroup END + endif +endif @@ -58,9 +58,6 @@ endif " the open buffers; I'll open the file if I want to complete from it set complete-=i -" Rebind Ctrl-C in insert mode to undo the current insert operation -inoremap <C-c> <C-c>u - " A few very important custom digraphs if has('digraphs') digraph ./ 8230 " Ellipsis (HORIZONTAL ELLIPSIS U+2026) @@ -344,36 +341,6 @@ if has('user_commands') command! -bang WA wa<bang> endif -" Keep screeds of undo history -set undolevels=2000 - -" Keep undo history in a separate file if the feature is available, we're on -" Unix, and not using sudo(8); this goes really well with undo visualization -" plugins like Gundo or Undotree. -if !strlen($SUDO_USER) && has('unix') && has('persistent_undo') - - " Keep per-file undo history in ~/.vim/undo; the double-slash at the end - " of the directory prods Vim into keeping the full path to the file in its - " undo filename to avoid collisions; the same thing works for swap files - set undofile - set undodir^=~/.vim/undo// - - " Create the ~/.vim/undo directory if necessary and possible - if !isdirectory($HOME . '/.vim/undo') && exists('*mkdir') - call mkdir($HOME . '/.vim/undo', 'p', 0700) - endif - - " Don't track changes to sensitive files - if has('autocmd') - augroup undoskip - autocmd! - silent! autocmd BufWritePre - \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* - \ setlocal noundofile - augroup END - endif -endif - " When in visual block mode, let me move the cursor anywhere in the buffer; " don't restrict me only to regions with text if has('virtualedit') |