Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: retrieving the results of last command?
- X-seq: zsh-users 8878
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh User <zsh-users@xxxxxxxxxx>
- Subject: Re: retrieving the results of last command?
- Date: Fri, 20 May 2005 14:49:42 +0000
- In-reply-to: <20050520121834.GA32499@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20050520121834.GA32499@xxxxxxxxxx>
On May 20, 2:18pm, Francisco Borges wrote:
}
} Often I'm in the situation of using say:
}
} % locate a-file
} /usr/share/prog/a-file
} %
}
} Then I want to use the pathname to copy the file.
The least computationally expensive way to do this is to save the output
in the first place.
E.g., Functions/Zle/keeper in the current dev versions of zsh, available
from the SourceForge CVS server. You might even want to add
locate() { command locate "$@" | keep }
Another trick that I do is
# Imaginative function naming here, I know
esc-backquote() { BUFFER='$( '"$BUFFER"' )'; CURSOR=0 }
zle -N esc-backquote
bindkey '\e`' esc-backquote
Then I can search through the history any way I like and when I find the
command whose output I want to capture, type ESC-` to wrap it in $( ... ).
I also have
bindkey -s '\ev' '\e`vi '
so that ESC-v leaves me with "vi $( ... )" but I don't use that one much
any more, for some reason.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author