From owner-freebsd-questions@FreeBSD.ORG Thu Sep 26 01:06:10 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E5EC2E89 for ; Thu, 26 Sep 2013 01:06:09 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ABF3C215D for ; Thu, 26 Sep 2013 01:06:09 +0000 (UTC) Received: from r56.edvax.de (port-92-195-74-65.dynamic.qsc.de [92.195.74.65]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPS id 525F827844; Thu, 26 Sep 2013 03:06:06 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id r8Q160wc007121; Thu, 26 Sep 2013 03:06:00 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Thu, 26 Sep 2013 03:06:00 +0200 From: Polytropon To: Gary Kline Subject: Re: minor vi/vim qstn Message-Id: <20130926030600.8850ddc5.freebsd@edvax.de> In-Reply-To: <20130926002104.GA12932@ethic.thought.org> References: <20130925212741.GA19434@ethic.thought.org> <20130926002327.6502d1b9.freebsd@edvax.de> <20130926002104.GA12932@ethic.thought.org> Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: FreeBSD Mailing List X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2013 01:06:10 -0000 On Wed, 25 Sep 2013 17:21:04 -0700, Gary Kline wrote: > Organization: Thought Unlimited. Public service Unix since 1986. > Of_Interest: With 27 years of service to the Unix community. > > On Thu, Sep 26, 2013 at 12:23:27AM +0200, Polytropon wrote: > > On Wed, 25 Sep 2013 14:27:41 -0700, Gary Kline wrote: > > > am I misremembering this feature, or didnt vi have a syntax where > > > you typed something like: > > > > > > % vi[#] or % vi [-2] [or vi [-N] > > > > > > to repeat the last or the second from last command? with my > > > shoulder sore bloody sore I need to save every key stroke. > > > > To repeat the last command, "." can be used. > > > > The vi editor (and probably vim and gvim) supports > > according to "man vi": > > > > [Vi]i[sual][!] [+cmd] [file] > > Vi mode only. Edit a new file. > > > > Is this what you're searching for? > > > I THOGoHT it was "!", but lookit: > > > pts/14 17:11 [5010] vi sent > pts/14 17:11 [5011] vi! > zsh: command not found: vi! > pts/14 17:12 [5012] > > ....... this is vi == vim. > > AHA:: found it. it's [bang] > > > pts/14 17:17 [5016] vi sent > pts/14 17:17 [5017] !v > > > I'll tell ya, if vi disappeared , I'd end it all! Ah, I see - you've been refering to repeating a _shell_ command (so the question was regarding the shell, which in your case is Z shell). You can probably use (like in the C shell) the arrow keys to browse the command history. Similarly, you can use the "!" command refering to the command number obtained by the "history" command. There's a handy alias defined globally for the C shell: "h" which means "history 25" (lists the last 25 commands), handy in regards of saving keystrokes. :-) I assume the zsh is also capable of "filtered history": For example, you enter "vi s" and use the up and down arrow keys to browse all commands that have been entered starting with "vi s" (for example "vi sent", "vi stuff" and so on). If the system's csh can do this, zsh should also provide this useful feature. And as your prompt "pts/14 17:12 [5012]" suggests, the command number is being shown. If this information is the same as the command number in the history, entering "!5010" would execute the 2nd from last command. To repeat the last command, whatever it has been, "!!" can be used. Again, this works in csh, so I can't predict if it will work in zsh too, but I _assume_ it does. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...