Jump by word in the command line in iTerm2
I use iTerm2 as the terminal in macOS, but the conventional shortcuts ctrl + ->/<-
to quickly jump backward/forward does not work in iTerm2 by default. I am always annoyed by that so I Google a little bit and found the solution. Here’s how to set it up (bonus tip at the end):
Steps:
- Open
Settings
- Select
Profiles
tab - Select the profile you are using under the
Profile Name
(for me it’sDefault
) - Select
Keys
tab, thenKey Mappings
tab - In the
Presets...
dropdown, selectNatural Text Editing
- Select
Keep
/Remove
when it asks if you want to keep all current mappings before loading the preset (I chooseRemove
because I don’t have any customized mappings set anyway) - That’s it!
Bonus tip: apparently one can also hold option
then click in the command to jump there! I personally still prefer keyboard shortcuts when two hands are on the keyboard though.