Fix persisted undo history in vimrc

This commit is contained in:
Michael Campagnaro 2016-11-04 15:19:59 -04:00 committed by GitHub
parent 114cd0c52c
commit d3cb264cbb

16
vimrc
View File

@ -121,9 +121,23 @@ set list listchars=tab:»·,trail:·
set timeoutlen=300 ttimeoutlen=0
" Allow undo when doing back into a closed file
set undodir=$HOME/.vim/undo
set undolevels=1000
set undoreload=10000
" Keep undo history across sessions by storing it in a file
if has('persistent_undo')
let undo_dir = expand(s:vim_dir . '/undo')
" Create dirs
if IsWindows()
let mkdir = 'mkdir '
else
let mkdir = 'mkdir -p '
endif
:silent call system(mkdir . s:vim_dir)
:silent call system(mkdir . undo_dir)
let &undodir = undo_dir
" Persist undo
set undofile
endif
" When loading text files, wrap them and don't split up words.
au BufNewFile,BufRead *.txt setlocal wrap