Skip to content

Instantly share code, notes, and snippets.

@rannn505
Created January 26, 2022 23:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rannn505/0496cf92e65c69c12a8e38181dd98e6d to your computer and use it in GitHub Desktop.
Save rannn505/0496cf92e65c69c12a8e38181dd98e6d to your computer and use it in GitHub Desktop.
Common keyboard shortcuts for iTerm2
{
"Key Mappings": {
"0xf702-0x300000-0x7b": {
"Label": "Cursor Start ⌘←",
"Action": 11,
"Text": "0x01"
},
"0xf703-0x300000-0x7c": {
"Label": "Cursor End ⌘→",
"Action": 11,
"Text": "0x05"
},
"0xf702-0x280000-0x7b": {
"Label": "Cursor Word Left ⌥←",
"Action": 11,
"Text": "0x1b 0x62"
},
"0xf703-0x280000-0x7c": {
"Label": "Cursor Word Right ⌥→",
"Action": 11,
"Text": "0x1b 0x66"
},
"0xf702-0x220000-0x7b": {
"Label": "Select Word Left ⇧←",
"Action": 45,
"Text": "0"
},
"0xf703-0x220000-0x7c": {
"Label": "Select Word Right ⇧→",
"Action": 46,
"Text": "0"
},
"0x7f-0x100000-0x33": {
"Label": "Delete All ⌘⌫",
"Action": 11,
"Text": "0x15"
},
"0x7f-0x80000-0x33": {
"Label": "Delete Word Left ⌥⌫",
"Action": 11,
"Text": "0x01b 0x08"
},
"0x7a-0x100000-0x6": {
"Label": "Undo ⌘Z",
"Action": 11,
"Text": "0x1f"
},
"0x5a-0x120000-0x6": {
"Label": "Redo ⌘⇧Z",
"Action": 11,
"Text": "0x18 0x1f"
}
}
}
@rannn505
Copy link
Author

  • Download the .itermkeymap file 💾
  • Open iTerm2 iterm2-icon
  • Press command ⌘ + , to open preference ⚙️
  • Navigate to "Profiles" tab 👤
  • Choose your default profile - the one with the ⭐ next to him (it's called "Default" if you haven't changed anything)
  • Navigate to "Keys" and inside to "Key Mappings" 🔑
  • At the bottom, click on "Presets ..." then import 🔗
  • Select the .itermkeymap file ⌨️
  • Enjoy shortcuting ⚡
import.iterm.key.mappings.mov

iterm2-preferences

@xiuyongwu
Copy link

Hi, thanks for the great file.

I found something interesting. The combination of command (⌘) and Right arrow (➡️) can move the mouse to the end of the command line in the terminal. However, if I open one file using vi and then use this combination, it fails. Rather, it moves the windows to include one more line.

I'm just wondering why is that.

Do you have some ideas?

Best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment