Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: refering to 2nd from last history parameter?
- X-seq: zsh-users 19762
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-user <zsh-users@xxxxxxx>
- Subject: Re: refering to 2nd from last history parameter?
- Date: Thu, 22 Jan 2015 12:57:13 +0000
- In-reply-to: <XnsA42A7D32D20B8davidrayninfocouk@80.91.229.13>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <XnsA42A7D32D20B8davidrayninfocouk@80.91.229.13>
On Thu, 22 Jan 2015 12:18:19 +0000
zzapper <david@xxxxxxxxxxxxxx> wrote:
> I don't think it's possible
>
> ls !$ last parameter of previous command
>
> echo a b c d e f g h
>
> I don't think I can grab 'g' without counting left to right
This isn't actually a question :-). What are you trying to do? Are you
at the shell command line trying to extract something and don't care if
you use the editor or history, but happen to know there was a way to do
something a bit like this in the history? I'll assume that but let us
know if that's not the case.
You can use the insert-last-word standard widget (\e. in Emacs mode)
combined with the copy-earlier-word shell widget, which I have bound as
autoload -Uz copy-earlier-word
zle -N copy-earlier-word
bindkey '\e=' copy-earlier-word
Then the answer is that you type "\e." to get the h then "\e=" to go
back to the "g". I use this all the time.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author