]> git.phdru.name Git - dotfiles.git/commitdiff
.vimrc: keep undo history across sessions by storing it in a file
authorOleg Broytman <phd@phdru.name>
Thu, 10 Nov 2016 19:58:53 +0000 (22:58 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 10 Nov 2016 19:58:53 +0000 (22:58 +0300)
.vimrc

diff --git a/.vimrc b/.vimrc
index 852d3cb21fb0abe5c8ae7a1a37c151f762295f09..745587a5e393214248f73fe86e1bf5a61a42bc26 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -129,7 +129,7 @@ endif
 if has("win32")
    set directory=$TEMP//,c:/tmp//,c:/temp//
 else
-   set directory=~/tmp//,/var/tmp//,/tmp//
+   set directory=~/tmp/vim//,~/tmp//,/var/tmp//,/tmp//
 endif
 " if a directory ends in two path separators "//"
 " or "\\", the swap file name will be built from the complete path to
@@ -144,6 +144,15 @@ set wildignore+=*.py[co] " Ignore these patterns when completing file names
 set wildmenu      " command-line completion shows a list of matches
 set wildmode=longest,list:longest,full " Bash-vim completion behavior
 
+" Keep undo history across sessions by storing it in a file
+if has('persistent_undo')
+    let myUndoDir = expand('$HOME/tmp/vim/undo')
+    " Create dirs
+    call system('mkdir -p ' . myUndoDir)
+    let &undodir = myUndoDir
+    set undofile
+endif
+
 " 22 executing external commands
 
 if has("filterpipe")