Insert last word of previous line

I mapped <a-.> in insert mode to inserting the last WORD of the previous line:

define-command -hidden -override insert-last-word-of-prev-line %{
    execute-keys -draft 'Z;kgl<a-i><a-w>yzP'

map global insert <a-.> '<a-;>: insert-last-word-of-prev-line<ret>'

This is the same keybinding used in Bash (readline) to paste the last argument of the previous command. It’s useful when writing shell scripts.


I didn’t knew this bash shortcut ! it’s pretty sweet