Reputation: 5041
On most mac applications Shift+Arrow selects text but in iterm it just moves the cursor without selecting. How do you get it to select the text?
Would also be curious if there's a way to do this in terminal.app, too.
Upvotes: 50
Views: 28728
Reputation: 81
All these options are viable but there's something simpler one can do. In key mappings there's a special preset called "Natural text editing" that covers the most part. You would only need to add two shortcuts for text selection.
Upvotes: 5
Reputation: 1623
To extend @merlin answer here are some more iTerm2 key bindings for navigation/deletion
⌘ Del | send hex 0x15 | delete line
⌥ Del | send hex 0x1B 0x08 | delete word
⌘ ← | send hex 0x01 | move a cursor to the beginning of a line
⌘ → | send hex 0x05 | move a cursor to the end of a line
⌥ ← | send esc seq Esc+b | move a cursor to the left by word
⌥ → | send esc seq Esc+f | move a cursor to the right by word
⇧ ⌥ ← | move start of sel back by word | select to the left by word
⇧ ⌥ → | move end of sel forward by word | select to the right by word
Upvotes: 23
Reputation: 1987
Follow the directions in this superuser answer which describes using the iTerm custom key bindings to map ⌥ + ⇧ + ← to select by word. Its smart to make new key mappings in a profile to test it out, rather than the main keys preference.
iTerm: Preferences > Profiles > Keys
Click +
to add a keybinding, Click to Set
⌥ + ← | Action: Move start of selection back > Move by character
⌥ + → | Action: Move end of selection forward > Move by character
⌥ + ⇧ + ← | Action: Move start of selection back > Move by word
⌥ + ⇧ + → | Action: Move end of selection forward > Move by word
your ⌘ C or ⌘ V will work to copy/paste these selections
Upvotes: 41
Reputation: 301
in iterm it just moves the cursor without selecting. How do you get it to select >the text?
Yeah, iTerm has a special technique for text selection. Takes a little getting used to, but it's way faster than the ol' "shift+arrow" mac OS method.
If the text you want to select is anywhere in your current session's scrollback, just hit ⌘
+f
and then type the first few characters you want to select. iTerm will find the text and highlight it.
Then, hit tab
to extend the selection to the end of the next word, repeating tab
as many times as you need to fully select your required text.
When you're satisfied with the selection, go ahead and punch in your (⌘
+c
) + (⌘
+V
) or what have you.
Bonus: You can also use shift
+tab
to extend your selection backwards to the start of the previous word.
Upvotes: 30