Here are the shortcuts that will work in Terminal app.
Home: control + A
End: control + E
Next Word: esc, then f
Previous word: esc, then b
I like my shortcuts to be consistent across the most used applications: Chrome, Sublime Text 2 and iTerm. This way I don’t have to think about what application I’m in, and I can just hit the buttons.
I’ve set tab switch to option+command+left and option+command+right, home to command+left, and end to command+right and previous word to option+left, and next word to option+right. These shortcuts for the most part mimic the default behavior in Sublime Text 2 and other editors.
iTerm is a better alternative to Terminal app on Mac OS X. You can get it at iterm2.com.
Go to your iTerm and open preferences from the menu (iTerm-> Preferences) or by using command + , or ⌘ + , shortcuts. Open Profiles tab and click on Keys for the Default profile.
To set home — that is, to jump to the beginning of a line — press command+left and then select ‘Send Hex Code’ and enter value 001.
Repeat the same thing for end substituting shortcut with command+right and hex with 005.
To set up previous word shortcut, press down option+left and then select ‘Send Escape Sequence’ and enter b. For the next word option+right shortcut, enter f.
I don’t know why Terminal and iTerm by default have broken shortcuts. Maybe there is some history to it, but it seems like I’m not the only person who has encountered (and/or fixed) the issue:
- Love Your Terminal
- Fixing Home, End, Page Up, and Page Down in Leopard’s Terminal
- Skip to Next or Previous Word in iTerm Using Alt / Option + Left or Right Arrow Keys
- Become a Command Line Ninja With These Time-Saving Shortcuts
Reading blog posts is good, but watching video courses is even better because they are more engaging.
A lot of developers complained that there is a lack of affordable quality video material on Node. It's distracting to watch to YouTube videos and insane to pay $500 for a Node video course!
[End of sidenote]
To contact Azat, the main author of this blog, submit the contact form.
Also, make sure to get 3 amazing resources to FREE when you sign up for the newsletter.