From owner-freebsd-questions@FreeBSD.ORG Mon Jun 15 07:24:58 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1F87106564A for ; Mon, 15 Jun 2009 07:24:58 +0000 (UTC) (envelope-from onemda@gmail.com) Received: from mail-bw0-f228.google.com (mail-bw0-f228.google.com [209.85.218.228]) by mx1.freebsd.org (Postfix) with ESMTP id 5EB5C8FC0A for ; Mon, 15 Jun 2009 07:24:58 +0000 (UTC) (envelope-from onemda@gmail.com) Received: by bwz28 with SMTP id 28so407079bwz.43 for ; Mon, 15 Jun 2009 00:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=gQr5EYiDdjZRSLD2bgZH1UjLI71f9zFe0/49MLd9Nbc=; b=loj2wFWF5xhWxlb8qEmWJMEKntIomXCC2hZ0t6As2B6dHtTUc30R9ydYKo17WtyDOc JsOvoB493sff0jbx+wgtJZNaY3EUEOsckPxLqUhfEUKi7RLtah0/qRVx4C+FyHtmHCFg Hc/e0x5YcS1wGOtZdVqHNpKAAubnSh8YJWh24= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=jIQqiklI1L+G4IK26BC5DJMb0wbH+o9gLh0WqC+3c1ERPvF0+rVXJoVP3gm++GHPdI HkzXhmMWAELzPEgrkaKtXAiqjCDu7nYgWy4GL/Ab6S32z+5n6FWjnHuyfi8HNJ9Yb2CK HNVOIUeenY31N/VYTZAgkWvExA0j24Np+9sEA= MIME-Version: 1.0 Received: by 10.204.61.9 with SMTP id r9mr2998905bkh.156.1245050697381; Mon, 15 Jun 2009 00:24:57 -0700 (PDT) In-Reply-To: <20090615024643.GA33420@thought.org> References: <20090615024643.GA33420@thought.org> Date: Mon, 15 Jun 2009 09:24:57 +0200 Message-ID: <3a142e750906150024v2936759amd5229ccbb2a71daf@mail.gmail.com> From: "Paul B. Mahol" To: Gary Kline Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: FreeBSD Mailing List Subject: Re: vim question... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jun 2009 07:24:59 -0000 On 6/15/09, Gary Kline 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