4 ms·
> inserts the previous command's parameters/arguments at the cursor In zsh, there are equivalent expansions: !!:1 previous command line, arg 1 (zero-inde
by quesera 3y ago
> inserts the previous command's parameters/arguments at the cursor
In zsh, there are equivalent expansions:
!!:1 previous command line, arg 1 (zero-indexed)
!!:$ previous command line, LAST arg
!!:1-$ previous command line, args 1-end (zero-indexed)
So, e.g.:
cat /etc/passwd /etc/shadow /etc/group
vi !!:1-$
(becomes)
vi /etc/passwd /etc/shadow /etc/group
- bloopernova 3y agoNice! I'll have to add those to my wall of index cards with useful commands.
- quesera 3y agoI use !!:$ occasionally. If I wanted to do the cat/vim switcheroo you described, I'd more likely do: <UpArrow><Esc>vcwvi<Esc>:wq<Enter><Enter> Which is a greater number of keypresses, but more flexible and requires less thought. ...as they say: Unix is user-friendly — it's just choosy about who its friends are.
- boring_twenties 3y agoThose all work in bash too, I believe they come from csh