Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get last argument of last command on ESC-. ZSH Vim mode

I want to have the same function of Bash+emacs_mode on Zsh+vi_mode, when you type ESC+. you get the last argument of the last command under the cursor. How can I get it on ZSH?

like image 310
Jean Carlo Machado Avatar asked Jan 07 '23 00:01

Jean Carlo Machado


1 Answers

You can use the same widget (insert-last-word) in both viins and emacs mode; it just isn't bound to a key by default in viins mode.

Run the following in the current shell (and add it to .zshrc for it to take effect in future shells).

bindkey -M viins '\e.' insert-last-word
like image 149
chepner Avatar answered Jan 17 '23 07:01

chepner