Zsh Mailing List Archive
Messages sorted by:
Re: bck-i-search for single parameters
- X-seq: zsh-users 12757
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: "Dan Vanderkam" <danvdk@xxxxxxxxx>
- Subject: Re: bck-i-search for single parameters
- Date: Wed, 2 Apr 2008 20:19:14 +0200
- Cc: zsh-users@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=RMJTQv3N1odH99p73if317AItmtUuHsVPcyGtuoAJ5M=; b=CNyfwQafK/o6yqFdaQFh8ix52ACwRrvfigNrO+JGtVtUfrr5jy1eNSHI/m4MJ/0y5Q2oPAU8Gt5MmEDb2PXDR6mFehwkYQTkx3Mc5Dy9ciE9sD0gG+bRj5SZW3EmzLmkrZrVER9657pwJQxYYCqhiuc0GCU/H0IJnyfAX7bsSIs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=t+LeVVgCh/ZvGn56O17KpwkPTYXtCYvCkaMBc5K+P2ke8GoQzZhkHKZyVygv9TnL+Yw60EmhM0xm68LyCJhBAxCxr5/vnBJUlKj6J41tpb3xZ7QcoRgOBjUHbxpe2mR+BuVxENbO7NjSSYPMGjh4s3tePEmxC0HEqMSQ5yqRlj8=
- In-reply-to: <1d018d3d0804021115m534b1148h53522b5131dab0ad@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <1d018d3d0804021115m534b1148h53522b5131dab0ad@xxxxxxxxxxxxxx>
On 02/04/2008, Dan Vanderkam <danvdk@xxxxxxxxx> wrote:
> I love being able to hit Ctrl-R to do a search backwards through my
> command line history. I don't know how I lived without it. My only
> complaint is that, more often than not, I find myself writing command
> lines by combining flags from several other CLs. For example, I might
> want to run a program (A) over the output of a previous program (B).
> In my perfect zsh world, I'd ctrl-R back to the CL I previously typed
> in to run program A. Then I'd do a history search for that single
> parameter to program B to put them together.
> Is there any way to do this? It would be like alt-period, only it
> would let you search, rather than just pulling up the last parameter
> to previous commands. Any ideas would be greatly appreciated.
I like to use narrow-to-region for this. It was a bit hard to use so
i made a wrapper function for it.
zle -N _narrow_to_region_marked
bindkey "^X^I" _narrow_to_region_marked
autoload -U narrow-to-region
if ((MARK == 0)); then
if ((MARK < CURSOR)); then
narrow-to-region -p "$left>>|" -P "|<<$right"
So you would ctrl-R search for command A, then type a | and press ^X^I
and then ctrl-R for command B and press enter, that will exit the
narrow-to-region mode and combine the two commandlines.
Messages sorted by: