Date: Mon, 15 Jun 2009 09:24:57 +0200 From: "Paul B. Mahol" <onemda@gmail.com> To: Gary Kline <kline@thought.org> Cc: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: vim question... Message-ID: <3a142e750906150024v2936759amd5229ccbb2a71daf@mail.gmail.com> In-Reply-To: <20090615024643.GA33420@thought.org> References: <20090615024643.GA33420@thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 6/15/09, Gary Kline <kline@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. -- Paul
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3a142e750906150024v2936759amd5229ccbb2a71daf>