Add support for persistent-undo in vim >= 703
authorUlrich Dangel <uli@spamt.net>
Mon, 27 Sep 2010 19:54:16 +0000 (21:54 +0200)
committerFrank Terbeck <ft@grml.org>
Mon, 27 Sep 2010 20:02:00 +0000 (22:02 +0200)
Store the undo file in ~/.vim/undo. The directory will be created
automatically if possible.

Acked-by: Michael Prokop <mika@grml.org>
etc/vim/vimrc

index ddc3125..505449c 100644 (file)
@@ -244,6 +244,20 @@ if version >= 700
   "  highlight PmenuThumb cterm=reverse  gui=reverse guifg=Black   guibg=#AAAAAA  " thumb of the scrollbar
 endif
 
+if version >= 703
+ " enable persistent-undo
+ set undofile
+
+ " store the persistent undo file in ~/.vim/undo
+ set undodir=~/.vim/undo/
+
+ " create undodir directory if possible and does not exist yet
+ let targetdir=$HOME . "/.vim/undo"
+ if isdirectory(targetdir) != 1 && getftype(targetdir) == "" && exists("*mkdir")
+  call mkdir(targetdir, "p", 0700)
+ endif
+endif
+
 " Source a global configuration file if available
 " Deprecated by Debian but still supported by grml
   if filereadable("/etc/vim/vimrc.local")