22

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.

1 Answer 1

7

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

3
  • 2
    I will accept this answer as it is clearly as good as we're going to get. BUT, readers should be aware that the functionality detailed here may be different from what they might expect.
    – JimmidyJoo
    Commented Jan 2, 2017 at 13:52
  • 1
    a) “Move by line” is basically unusable to people expecting text-editor-like functionality only within the user-editable portion of the command line.
    – JimmidyJoo
    Commented Jan 2, 2017 at 13:52
  • b) Most Mac users may like this, but separating the moving of the selection into "start" and "end" parts means that at best you can only get native Mac-style selection-moving when mixing back and forward selection-moves, rather than the (more Windows and Linux-centric?) convention used by Sublime Text. (This is hard to explain — try it out to see what I mean.)
    – JimmidyJoo
    Commented Jan 2, 2017 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .