Skip to content

Instantly share code, notes, and snippets.

@ro31337
Created December 13, 2025 21:35
Show Gist options
  • Select an option

  • Save ro31337/6cbcb5f42895a7f4b67799371d406978 to your computer and use it in GitHub Desktop.

Select an option

Save ro31337/6cbcb5f42895a7f4b67799371d406978 to your computer and use it in GitHub Desktop.
iTerm2 MacOS option-left option-right

Run this:

mkdir -p ~/iterm2

cat > ~/iterm2/emacs-navigation.itermkeymap <<'EOF'
{
  "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": "Word Left ⌥←",   "Action": 11, "Text": "0x1b 0x62" },
    "0xf703-0x280000-0x7c": { "Label": "Word Right ⌥→",  "Action": 11, "Text": "0x1b 0x66" }
  }
}
EOF

open -R ~/iterm2/emacs-navigation.itermkeymap # didn't work out, but proceed to the next step

Import:

iTerm2 → Preferences → Profiles → (your profile) → Keys → Key Mappings → Presets… → Import… → pick that .itermkeymap.

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