tags:

views:

144

answers:

2

After I commit a file to Perforce, it becomes read-only.

If I have this file open in vim, I've just lost my undo-redo history, without even being asked.

How do I make this not happen?

A: 

Maybe you could try to make it readable with modelines :

#vim : set noreadonly:

I wrote # but of course you must replace it with the adequate symbol for a comment.

Taurus Olson
+1  A: 

It is kind of Vim bug. Whenever you “:edit filename”, implicitly or explicitly it seams that Vim is zeroing all undo history for this file because ( I guess ) it think that it is newly opened file. And after perforce commit, your file is kind of “changed outside” and Vim should ask you “Reload file?” unless you set “autoread”.

Check you vimrc for “set autoread” option.

Mykola Golubyev
Thank you!I indeed had "set autoread" in my vimrc.Problem solved.