Another short one but very useful trick in my moving from Linux to Mac series.
One of my most used shortcuts in the terminal is Alt + .
, which I adapted from my bash
workflow to my zsh
workflow
when I started using zsh. It basically inserts the last word from the previous command. This turns out to be very handy
and I use it multiple times a day.
There is no out of the box way to accomplish this on Mac, unless you use iTerm
.
The first step is opening up iTerm preferences and navigate to the keybindings section.
Once in the keybindings section:
- Click
+
. - In the dialogue select any Keyboard Shortcut you want. I used
Cmd + .
. - Select
Action
asSend Escape Sequence
. - Add
altdot
as theEscape Sequence
. - Hit
Save
and we’re done!
The next step is configuring zsh keybindings to process the Escape sequence
.
And viola, now the keybindings work. This process works mutatis mundis
for other keybindings that you want to import
from your workflow in bash/zsh from linux.