This orginal post is from here.
iTerm2 is a nice, customizable terminal emulator for OSX, but the typical cursor movement keys (such as
⌘←(Command-Left) for “move to beginning of line and⌥→(Option-Right) for”move forward one word”) never seem to work for me out of the box.Here’s how to set them up (based on build 2.1.4 but works 3.4.22):
- Clear out any per-existing bindings for these short-cuts. There two different places to check–in the “global” keys and in the “profile” keys.
For the profile keys go to
Preferences>Profiles>Keys>Key Mappingsand look for the⌘←,⌘→,⌥←and⌥→shortcuts (and delete them if found.)For the global keys go to
Preferences>Keysand look for the symbols in (and remove them from) the “Global Shortcut Keys”.
- In either the profile or global shortcut settings (your choice) add the shortcuts back in, with the following bindings:
Use
Send Escape Sequenceffor “move forward one word”. On OSX, I bind this to⌥→(Option-Right) as that seems to be the convention other apps follow.Use
Send Escape Sequencebfor “move backward one word”. On OSX, I bind this to⌥←(Option-Left).Use
Send Hex Code0x05for “move to end of line”. On OSX, I bind this to⌘→(Command-Right) as that seems to be the convention other apps follow.Use
Send Hex Code0x01for “move to beginning of line”. On OSX, I bind this to⌘←(Command-Left).Now these keys should work the way your muscle memory (or at least my muscle memory) expects them to.
In addition, as in iTem2, “next Tab” was bind to ⌘→(Command-Right), which has been replaced, I set up tab navigation as following:
Using
Next Tabfor “move to next tab”, I bind this⌥⌘→(Option-Command-Right)Using
Previous Tabfor “move to previous tab”, I bind this⌥⌘←(Option-Command-Left)
You can download this file for my keymapping file iterm2mapping.itermkeymap for iTerm2
Back to top