vim question...

Giorgos Keramidas keramida at
Mon Jun 15 16:12:05 UTC 2009

On Sun, 14 Jun 2009 19:46:45 -0700, Gary Kline <kline at> wrote:
> the main reason i don't use vim is because of its [u]ndo command.  as
> most of you can understand, there are a whole slew of times when i
> need to undo something.  too often in vim, hitting 'u' --- sometimes >
> once accidentally --- has resulted in a small disaster.  [[i have too
> many current/recent copies of my working files to do TOO much
> damage!]]  Anyway, is there a means of setting the undo key to mimic
> vi/nvi?

Hi Gary,

If you accidentally type 'u' in vim, you can "redo" it by ^R.  There is
also the "set compatible" option, but it isn't exactly "compatible" with
the nvi behavior.

In nvi, typing 'u' can undo the last operation.  Then repeating the undo
command with '.' keeps undoing changes until the buffer is reverted to
its original state.

In vim, with "set compatible" enabled", typing 'u' repeatedly toggles
between the last two states of the buffer.  In "compatible" mode I am
not sure of how to undo multiple changes.  In "set nocompatible" mode,
typing 'u' repeatedly undoes multiple changes, and typing '^R' multiple
times redoes them.

More information about the freebsd-questions mailing list