I'm using Vim 6.2.457. Every time I try to edit a new file using "e $filename" or switch buffers with ":bn" or ":bp", I lose the undo stack. Does anyone know how to preserve that?
I can't help, but...
cog on 2005-02-08T16:58:34
If you really need it, and you don't find an answer here, post your question to the
Vim mailing list.
I'm pretty sure they'll be able to help :-) It's one of the best mailing lists out there :-)
Re:I can't help, but...
Ovid on 2005-02-08T17:12:58
Thanks! I just subscribed. I should have done that earlier but I'm awfully used to everyone here just knowing their stuff :)
(bad Ovid. No Corinna (private joke))
If you do find an answer. . .
CromeDome on 2005-02-08T20:49:53
Please post about it. I'd love to know a solution or workaround for this.
Thanks!
Re:If you do find an answer. . .
Ovid on 2005-02-08T21:22:00
As noted below, the fix is to :set hidden. I'm quite relieved to know it's that simple :)
set hidden
rjbs on 2005-02-08T20:51:02
The 'hidden' option is a secret key to effective Vimming.
With 'nohidden' set, Vim discards the buffer when you leave it. It loses all its session data, like the undo stack. It's also slower if you switch a lot, because it rereads the file to open the buffer when you switch back to a discarded buffer.
If you set 'hidden' Vim will keep the buffer around when you leave it. You won't lose anything, except a little memory for the buffer to live in.
Sometimes I use a box on which I haven't installed
my vimrc and hidden isn't set. It's scary.
The mailing list for Vim is decent, but noisy. I prefer #vim on freenode. It has a few very clued regulars, and I'm there too.
Re:set hidden
Aristotle on 2005-02-09T02:38:41
Whoa thanks — very nice tip!