Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: "expanding" to copy-earlier-word
On Thu, 13 Aug 2015 10:57:27 +0100
Dominik Vogt <vogt@xxxxxxxxxxxxxxxxxx> wrote:
> I've bound ctrl-j to copy-earlier-word, so I can copy the last word
> of the previously executed command line to the current command
> line. Is there a way to do the same as part of the expansion
> process?
Hisotry expansion allows you to select previous words, but you'll need
to count from the left when retrieving words from the current line: you
can use ":$" to indicate the last argument, which with !# is the
previous argument, but "-" indicates a range, not a negative offset.
There was some discussion about this anomaly a couple of months ago;
it's potentially fixable with some new syntax (I've forgotten if there
was a conclusion).
> What I'd like to have this something like this:
>
> $ make foo
> $ ./<copy-earlier-word>
./!:$
> or even
>
> $ make foo; ./<copy-earlier-word>
make foo; ./!#:1
(remember history expansion starts with word 0). Unfortunately !#:$
gets you the ";" because while history expansion knows about dividing
into words it doesn't know which words are syntactically important.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author