Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Better way to execute commands from history?
- X-seq: zsh-users 14333
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: sam reckoner <sam.reckoner@xxxxxxxxx>
- Subject: Re: Better way to execute commands from history?
- Date: Wed, 2 Sep 2009 22:24:16 +0200
- Cc: zsh-users@xxxxxxxxxx
- 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; bh=n+bISWGgAJyNGlulQuL/tolFE+wJ0TNUzYsrJNPzUvc=; b=Vh89ZSSDvNc0bI8szj2wtkw4LK2vhj9FuvAGsaPxC9JLXkt0M4HeRFa+MpX4YzYKEF BnPDRdTNK5+rfn3c3WTjQZtqQxwZelxMH6OStOvuEhhIQYQO6C5AQG/D3OkzRwko8538 OBsX+EZhiV/hMLMm4jtpR7fKJ6KcCxihgtVio=
- 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; b=Zgkdbho2mj5S9Qi+IfPgRkRk5R9ELJiZ0wSI4KxL+ICUK1Us8L/1AA/iZWUvT7kKkI fsnY3y5vlRzkYFcQP3C1AZi/yP0Mc0ydq/gKD4UlzxmS6omrGKAr/idpHIZa7dPi+If6 +JjYGxcqbj7/Nd+Dqoo4tm8tSVtjsfmAP9+X4=
- In-reply-to: <6a42eec70909021254p62849de5r2c53d7f29fec3f07@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <6a42eec70909021254p62849de5r2c53d7f29fec3f07@xxxxxxxxxxxxxx>
2009/9/2 sam reckoner <sam.reckoner@xxxxxxxxx>:
> Hi,
>
> I am in the habit of doing the following:
>
> % fc -l -1000| grep -i cd | grep -i link | tail -1 | cut -d" " -f3
>
> which gives me the number of the command that contains both "cd" and
> "link" in it. I then manually type in
>
> % !num
>
> where num is the output of the first command. I know there is a C-R
> command, but doing it as above makes it possible to search the entire
> string in the history list for multiple items.
>
> I'm sure there's a better way to do this.
If you rebind ^R (and ^[^R) to history-incremental-pattern-search-forward
(the default is without the "pattern-"), you can press ^R and type cd*link
to get the same result, but you can iterate backwards as usual too.
bindkey "^R" history-incremental-pattern-search-backward
bindkey "^[^R" history-incremental-pattern-search-forward
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author