Select text in iTerm using keyboard
Yes! In iTerm2, do this:
From the relevant documentation
- Cmd-F
- Type some text that matches part of what you want to copy.
- When you have a partial match on what you want to copy, you can expand the selection.
Press tab to grow it one word to the right; press shift-tab to grow it one word to the left.
As soon as you press tab or shift-tab, it is copied to the clipboard. You can press option-Enter to immediately paste the selection and close the find bar at once.
You could also assign custom keys in Prefs -> Keys
. (Source)
Similarly settings can also be used to move line selection.
Alternatively, the autocorrect feature reduces the need for copy-paste. Just type the start of some text that is either on the screen or you have copy-pasted recently and press cmd-;. A popup window appears and you can choose from there. Autocorrect works best for a single word, though.
(I updated this answer to reflect new features in iTerm 3.0. Thanks to @sfarzy for the suggested edits)
You can use "Edit->Copy Mode" by default Shift+Cmd+C, In there you can use VIM-like shortcuts:
/ will allow you to search, v to select, And while selecting you can use $ to move to the end of the line and finally the good ol' Cmd + C to copy.
From the iTerm2 documentation:
Text Selection
There are two ways to select text to copy to the clipboard: you can use the mouse, or you can use the find feature's "mouseless copy" feature. Text selection by mouse is described later in General Usage section.
To select text without using the mouse, press cmd-f to open the find field. Enter the beginning of the text you wish to copy and the find feature will select it in your window. Then press tab and the end of the selection will advance by a word. To move the beginning of the selection to the left, press shift-tab. At most one line of text can be selected this way.