Reputation: 650
In zsh (and bash), I can do ALT+. to insert the last argument of the previous command into the command line.
Is there something similar for the first word?
Example: After running /bin/ls -l /tmp
, I want it to insert /bin/ls
.
Upvotes: 0
Views: 669
Reputation: 650
I found Alt+number+dot and Alt+comma in Zsh and Bash which basically answers my question:
In zsh, you can do ALT+0 ALT+.
It is a bit unwieldy to press three buttons for this, but it is built-in and works.
Upvotes: 0
Reputation: 19335
found this in a .zshrc
insert-first-word () { zle insert-last-word -- -1 1 }
zle -N insert-first-word
bindkey '^[_' insert-first-word
then alt + _
Upvotes: 1