Keyboard Shortcuts for Jumping and Deleting in iTerm2

How to configure familiar keyboard shortcuts for common navigation and edit actions in the iTerm2 command prompt, such as jumping to the start or end of a word or line.


This content originally appeared on Marius Schulz and was authored by Marius Schulz

As a software engineer, I find myself using the terminal every day to run all sorts of commands. My current terminal of choice is iTerm2 which I’ve been using happily for many years.

Whenever I set up iTerm2 on a new Mac, one of the first things I do is to configure familiar keyboard shortcuts for common navigation and edit actions in the command prompt. For example, I typically configure the shortcut which jumps me to the start of the word under the cursor.

To configure custom keyboard shortcuts in iTerm2, open the preferences dialog and navigate to the Profiles › Keys › Key Mappings tab:

iTerm2 Preferences: Profiles › Keys › Key Mappings

Click the “+” button to add a new key mapping, or double-click an existing key mapping to edit it. For the “Jump to start of word” command, select the “Send Escape Sequence” action and send the escape sequence Esc+b:

iTerm2 Preferences: dialog for editing a key mapping

Now, whenever you're typing a command in iTerm2, it's really easy to jump back to the start of the word (or even multiple words) to insert more text or delete part of the command — no more need for repeatedly pressing the key to navigate back character by character.

Here's the full list of keyboard shortcuts that I configure for various jump and delete commands:

Shortcut Command Action Send
Jump to start of word Send Escape Sequence b
Jump to end of word Send Escape Sequence f
Jump to start of line Send Hex Codes 0x01
Jump to end of line Send Hex Codes 0x05
Delete to start of word Send Hex Codes 0x17
Delete entire line Send Hex Codes 0x15


This content originally appeared on Marius Schulz and was authored by Marius Schulz


Print Share Comment Cite Upload Translate Updates
APA

Marius Schulz | Sciencx (2022-06-05T00:00:00+00:00) Keyboard Shortcuts for Jumping and Deleting in iTerm2. Retrieved from https://www.scien.cx/2022/06/05/keyboard-shortcuts-for-jumping-and-deleting-in-iterm2/

MLA
" » Keyboard Shortcuts for Jumping and Deleting in iTerm2." Marius Schulz | Sciencx - Sunday June 5, 2022, https://www.scien.cx/2022/06/05/keyboard-shortcuts-for-jumping-and-deleting-in-iterm2/
HARVARD
Marius Schulz | Sciencx Sunday June 5, 2022 » Keyboard Shortcuts for Jumping and Deleting in iTerm2., viewed ,<https://www.scien.cx/2022/06/05/keyboard-shortcuts-for-jumping-and-deleting-in-iterm2/>
VANCOUVER
Marius Schulz | Sciencx - » Keyboard Shortcuts for Jumping and Deleting in iTerm2. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/06/05/keyboard-shortcuts-for-jumping-and-deleting-in-iterm2/
CHICAGO
" » Keyboard Shortcuts for Jumping and Deleting in iTerm2." Marius Schulz | Sciencx - Accessed . https://www.scien.cx/2022/06/05/keyboard-shortcuts-for-jumping-and-deleting-in-iterm2/
IEEE
" » Keyboard Shortcuts for Jumping and Deleting in iTerm2." Marius Schulz | Sciencx [Online]. Available: https://www.scien.cx/2022/06/05/keyboard-shortcuts-for-jumping-and-deleting-in-iterm2/. [Accessed: ]
rf:citation
» Keyboard Shortcuts for Jumping and Deleting in iTerm2 | Marius Schulz | Sciencx | https://www.scien.cx/2022/06/05/keyboard-shortcuts-for-jumping-and-deleting-in-iterm2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.