Selecting text while jumping with cursor in iTerm2

itermkeyboardshortcut

I would like to know if it is possible to get text-editor-like functionality for selecting text in iTerm2. For example, in Sublime Text 3, I can do the following:

⇧ ⌥ → = Select word to the right of the cursor.

⇧ ⌘ → = Select entire line to the right of the cursor.

But I cannot for the life of me seem to do this in iTerm2. I can add actions that make my cursor jump over words, or jump to the end of the line, but not jump and select at the same time.

To be clear: I am not looking for an alternative to highlighting text in this manner (for example any method that begins with a ⌘ F search or that requires a mouse), I am looking for the exact functionality outlined above.

Best Answer

You can setup key shortcuts for this functionality in iTerm2.

In Prefs > Profiles > Keys you can assign keys to move the beginning or end of the selection by a single character, word, or line. No such keys are bound by default.

To make a shortcut for the precise text selection you are referring to you would assign the shortcuts to the following actions,

⇧ ⌥ → = Move end of selection forward, Move by word

⇧ ⌘ → = Move end of selection forward, Move by line

Move end of selection forward, move by word Move end of selection forward, move by word

Source: https://www.iterm2.com/documentation-one-page.html