Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: implicit previous command, only state what should change



Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> writes:

> zsh% !:0 user-emacs-directory !:2*

Yes, only, if the other arguments (and the command) are
short or medium-length words I'd say it is in most
cases faster and more comfortable to just retype them.

> You can automate this for some simple cases (the
> following assumes you are using the default non-vi
> key bindings):
>
> bindkey -s ^X1 '^U!!:0 \e!^ !!:2*^X^X\e!'  bindkey -s
> ^X2 '^U!!:0-1 \e!^ !!:3*^X^X\e!'  bindkey -s ^X3
> ^U!!:0-2 \e!^ !!:4*^X^X\e!'  bindkey -s ^X4 '^U!!:0-3
> \e!^ !!:5*^X^X\e!'  bindkey -s ^X5 '^U!!:0-4 \e!^
> !!:6*^X^X\e!'
>
> With this, typing ctrl+x 1 will re-insert the
> previous line with the first argument omitted,
> leaving the cursor where the new first argument
> should be typed.  Similarly for ctrl+x 2 through 5,
> though they don't work quite ideally if there are no
> arguments following the one you're replacing (try it
> to see what I mean).

OK, get back to you.

-- 
underground experts united



Messages sorted by: Reverse Date, Date, Thread, Author