From: Oleg Broytman Date: Thu, 10 Nov 2016 19:58:53 +0000 (+0300) Subject: .vimrc: keep undo history across sessions by storing it in a file X-Git-Url: https://git.phdru.name/?p=dotfiles.git;a=commitdiff_plain;h=46454f2d385f4083f305c456a173866d0f557edf .vimrc: keep undo history across sessions by storing it in a file --- diff --git a/.vimrc b/.vimrc index 852d3cb..745587a 100644 --- 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")