By default, iTerm2 doesn’t allow you to move/jump cursor over words. This works by default on Ubuntu and other Linux terminals. Let's try to enable them in the MAC OS - iTerm2 application.
- Jump cursor forward over words using keyboard shortcut ⌥+←
- Jump cursor backward over words using keyboard shortcut ⌥+→
- Delete by word using keyboard shortcut ⌥+delete
Here’s how you can configure iTerm2 on Mac OS to allow you to do the above operations:
Open iTerm2 > Preferences > Profiles > Keys and add below shortcuts:
- Add forward jump(#1):
- Keyboard Shortcut: ⌥+←
- Action: Send Escape Sequence
- Esc+b
- Add backward jump(#2):
- Keyboard Shortcut: ⌥+→
- Action: Send Escape Sequence
- Esc+f
- Enable delete by word (#3):
- Navigate to the keyboard shortcuts section "iTerm2 > Preferences > Profiles > Keys"
- Change setting "Left option(⌥) key" from 'Normal' to 'Esc+'
- By changing this option, now you can use ⌥+delete to delete by word
Well done! Now you have all the 3 shortcuts enabled. This saves a lot while using the terminal for day to day activities. Have fun!
No comments:
Post a Comment