Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Select text areas via the keyboard in Terminal Apps
Tiger only hintThis is a menu item, new to Tiger, but who goes searching the menu items of their terminal emulator? Especially those buried in sub-menus?

You can now define the Mac-side text selection (the one you might normally create by clicking and dragging the mouse) using the keyboard in Terminal. Here's how:
  1. Choose the menu item Edit: Keyboard selection: Start keyboard selection, or just press Command-Option-Return. This command 'unhooks' the arrow keys from input; pressing them in this mode will not send arrow-key characters to the process running in the terminal.
  2. Use the arrow keys to navigate to the point where you want to start the selection.
  3. Choose the menu item Edit: Keyboard selection: Anchor selection at cursor, or press Command-Option-Return again. You have now set the start-point for the selection.
  4. Use the arrow keys to navigate to the point where you want to end the selection. You'll see the highlight appear as you move about; note that it is not a rectangular selection.
  5. Do what you wish with the selection. You can copy it manually via Command-C, drag the snippet with the mouse, cancel out of text selection mode by hitting Escape, or (easiest of all) just hit Command-Option_Return one more time. When you do, the selected text will be copied to the clipboard, the selection will vanish, the cursor will be back in its original location, and the arrow keys will be back to normal.
[robg adds: This is definitely new to Tiger, and since I'd overlooked it, I figured it might be worth sharing. It may seem clumsy at first, but after I'd tried it a few times, I found it to be a fast way to capture small chunks of Terminal output without reaching for the mouse.]
    •    
  • Currently 2.50 / 5
  You rated: 5 / 5 (4 votes cast)
 
[14,342 views]  

10.4: Select text areas via the keyboard in Terminal | 5 comments | Create New Account
Click here to return to the '10.4: Select text areas via the keyboard in Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Only need return after the first one
Authored by: sabi on Jan 20, '06 07:13:37AM

You only need to use return to delimit the selection after you've hit command-option-return once.



[ Reply to This | # ]
Use some bash cursor moment commands
Authored by: galaher on Jan 20, '06 10:43:15AM

You may also use some, but apparently not all, bash cursor moment commands to select in either direction. e.g. once keyboard selection has been invoked, 'control+a' selects backward to the beginning and or 'control+e' forward to the end of the line. 'control+f' selects one character forward and 'control+b' selects one character backwards. However, 'meta+f' and 'meta+b' cancels the selection instead of selecting one word at a time (I have the command key set to be the meta key).



[ Reply to This | # ]
meta key in terminal
Authored by: didier prophete on Jan 20, '06 11:53:42AM

This is awesome !! An amazing timesaver for us keyboard addicts...
Btw, since galaher started this: is there a way in bash/terminal to use the alt/option as the meta key, like on any linux/unix platform ? (I found myself rarely in need of typing an accent or some greek characters on the shell command line :-) Having to use 'esc' is ok, but it as galaher mentionned, it cancels the selection...



[ Reply to This | # ]
meta key in terminal
Authored by: Afuna on Jan 20, '06 12:55:13PM

Poked around a bit and found this:

Terminal menu item > Window Settings > Keyboard > Use option key as meta key > Use settings as defaults

:)



[ Reply to This | # ]
meta key in terminal
Authored by: sjmills on Jan 21, '06 09:32:16PM
This is awesome !! An amazing timesaver for us keyboard addicts
I agree. Very cool.

[ Reply to This | # ]