iTerm is a really great terminal replacement that I really like to use. One feature that I wanted to have after my migration from Windows to OS X is the ability to jump between words in the command line, and not having to go through the whole line character by character. It turns out that this is possible quite easily and without much pain and effort from your side. You do not need to pay 1 BTC to Apple to get this working. You only need to make a few keystroke changes in your iTerm preferences and you are done.
In other words, you do not need to install anything else in your OS X. All you have to do is do a few configurations in the iTerm preferences, and you are good to go. It’s that easy.
Let’s get started.
To make this work for the right option key you need to set the key modifier to act as an Escape Sequence.
First, you need to set your left ⌥ key key to act as an escape character.
After that, you can either change the current shortcut for ⌥ ← or create a new one, in the Profile Shortcut Keys, with the following settings:
- Keyboard Shortcut: ⌥←
- Action: Send Escape Sequence
- Esc+: b
Now we need to repeat a similar process for the ⌥→ keyboard shortcut with the following settings:
- Keyboard Shortcut: ⌥→
- Action: Send Escape Sequence
- Esc+: f
That’s all we need to do. After we are done, we may need to restart the iTerm to be able to use the changes that we have just made.
Now we can skip entire words on the command line interface by holding down the left ⌥ key and hitting ← or →.
I hope you find this article helpful.