Are there any permission settings that need set on a file to get persistent undo to work? I close and open my vimrc file and I can keep hitting the u key to see my previous edits. But it does not work for production code files. Any ideas what could be the issue?
Edited to Add:
Here is a sample of my .vimrc:
" Turn persistent undo on. This means that you can undo even when you close a
" buffer/VIM.
if has("persistent_undo")
if isdirectory(expand("~/.vim/temp_dirs/undodir"))
set undodir=~/.vim/temp_dirs/undodir
elseif isdirectory(expand("~/vimfiles/temp_dirs/undodir"))
set undodir=~/vimfiles/temp_dirs/undodir
else
echomsg "ERROR: undodir does not exist or is not writable."
endif
set undofile
endif
My .vimrc has 644 permission and is owned by snrub:snrub.
An example of a file that does not have persistent undo would be /var/www/html/sites/all/modules/custom/mymodule/mymodule.module
(this is a Drupal 7 installation).
This file has 664 permission and is owned by apache:apache. User snrub is a member of the apache group, so I do have write permission on the file.
verbose set undodir
gives the following:
undodir=~/.vim/temp_dirs/undodir
Last set from ~/.vimrc
...which is a directory that does exist.
'undodir'
setting is probably the answer to this question... But unfortunately it's too vague right now to be able to offer a good answer. How do you set the undo variables? (In other words, how do you enable persistent undo)? You mentioned the "production" code files, what is different about those in particular (in your environment) that could affect the behavior of undo? If you manage to ask a more specific question, you'll be likely to get a great answer.