3 ms·
After your cat command has run, type 'vim ' then hit the escape key plus the period/full stop key. That inserts the previous command's parameters/arguments at t
by bloopernova 3y ago
After your cat command has run, type 'vim ' then hit the escape key plus the period/full stop key. That inserts the previous command's parameters/arguments at the cursor.
Obviously you don't have to use vim, any other editor or whatever can be used.
- 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