Skip to content

Instantly share code, notes, and snippets.

@slava-konashkov
Last active February 24, 2021 17:13
Show Gist options
  • Save slava-konashkov/b9b9a126bce9d0e0cf21fc172fef2300 to your computer and use it in GitHub Desktop.
Save slava-konashkov/b9b9a126bce9d0e0cf21fc172fef2300 to your computer and use it in GitHub Desktop.
iTerm keymap
Preferences > Keys (or Preferences > Profiles > Keys)
Click the plus
move forward one word:
option+right
send escape sequence
f
move back one word:
option+left
send escape sequence
b
delete to beginning of word:
option+delete
send hex code
0x1B 0x08
delete to end of word:
fn+option+delete
send escape sequence
d
To delete the whole line:
CMD+Delete
Send Hex Code
0x15
Move to begin of the line:
CMD + Left (⌘ ←)
SEND HEX CODE
0x01
Move to the end of the line:
CMD + Right (⌘ →)
SEND HEX CODE
0x05
@slava-konashkov
Copy link
Author

Mapping keys manually (Advanced)
If you don't want to use the "Natural Text Editing" preset mentioned above, you can map the keys you need manually:

Open Preferences
Click “Keys” tab
Click the [+] icon
You can now add the following keyboard shortcuts:
Move cursor one word left

Keyboard shortcut: ⌥ + ←
Action: Send Hex Code
Code: 0x1b 0x62
enter image description here

Move cursor one word right

Keyboard Combination: ⌥ + →
Action: Send Hex Code
Code: 0x1b 0x66
Move cursor to beginning of line

Keyboard Combination: ⌘ + ←
Action: Send Hex Code
Code: 0x01
Move cursor to end of line

Keyboard Combination: ⌘ + →
Action: Send Hex Code
Code: 0x05
Delete word

Keyboard Combination: ⌥ + ←Delete
Action: Send Hex Code
Code: 0x1b 0x08
Delete line

Keyboard Combination: ⌘ + ←Delete
Action: Send Hex Code
Code: 0x15
Undo

Keyboard Combination: ⌘ + z
Action: Send Hex Code
Code: 0x1f
Don't forget to remove the previous bindings:

Open the “Profiles” tab
Click the sub-tab ”Keys”
Remove the mappings for key combinations ⌥ + ← and ⌥ + →

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