Paul B. Mahol
onemda at gmail.com
Mon Jun 15 07:24:59 UTC 2009
On 6/15/09, Gary Kline <kline at thought.org> 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?
>From vim help:
2. Two ways of undo *undo-two-ways*
How undo and redo commands work depends on the 'u' flag in 'cpoptions'.
There is the Vim way ('u' excluded) and the vi-compatible way ('u' included).
In the Vim way, "uu" undoes two changes. In the Vi-compatible way, "uu" does
nothing (undoes an undo).
'u' excluded, the Vim way:
You can go back in time with the undo command. You can then go forward again
with the redo command. If you make a new change after the undo command,
the redo will not be possible anymore.
'u' included, the Vi-compatible way:
The undo command undoes the previous change, and also the previous undo command.
The redo command repeats the previous undo command. It does NOT repeat a
change command, use "." for that.
Examples Vim way Vi-compatible way ~
"uu" two times undo no-op
"u CTRL-R" no-op two times undo
Rationale: Nvi uses the "." command instead of CTRL-R. Unfortunately, this
is not Vi compatible. For example "dwdwu." in Vi deletes two
words, in Nvi it does nothing.
Anyway this topic is offtopic.
More information about the freebsd-questions