Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Terminal app and 'select-by-word' characters aka 'character classes'

There are a couple of ancient threads where the poster asked if the OS X Terminal app is configurable wrt the characters used to determine what is a word, when clicking on a line of text. There are no answers to that, except to suggest that iTerm supports it.

Does anyone know if the character classes in Terminal are configurable?

Mini Core 2 Duo, Mac OS X (10.6.3), 4 GB - GSafe 2TB RAID1 - VMWare Fusion

Posted on Apr 14, 2010 5:34 PM

Reply
17 replies

Apr 15, 2010 7:08 AM in response to panomanic

I believe Terminal.app does not have such option.

There is a setting in
System Preferences > Language & Text > Text > Word Break
but I don't know whether this has any effects in Terminal.app.

The "word" selected by a double click in Terminal.app (and other Cocoa apps) is not just a string delimited by two characters in a "non-word character class". For example, if you double click on the f in 'foo' then only foo is selected, but double clicking on the d in don't selects whole don't (including the single quote).

Apr 15, 2010 11:17 AM in response to etresoft

I think know of what "panomanic" want, as I use iTerm to get this effect.

For example, in iTerm I configure iTerm -> Preferences -> Mouse -> Characters considered part of a word: ~_./-

This way, when I double click on a filename containing any of the above characters, it considers it part of the the word, so it is very easy to select an entire filename. I have been doing this since the early 90's.

gnome-terminal would be:
Terminal -> Edit -> Current Profile... -> General -> Select-by-word characters

xterm would use *charClass in the .Xresources file, although the encoding is not obvious. For example

*charClass: 45:48,46:48,47:48,58:48,64:48

would be dash (45), period (46), slash (47), colon (58), and at sign (64) to the existing alphanumeric class (48)

But to the best of my knowledge Mac OS X Terminal cannot be configured as to what constitutes a word when double-clicking on text in a Terminal window. This is just one of the reasons I use iTerm instead of Terminal. Note: I currently have 2 iTerm windows, and 21 tabs open on my iMac, connecting to 8 different Mac, Linux, Solaris, and AIX systems.

Apr 15, 2010 6:50 PM in response to etresoft

etresoft wrote:
Can you give an example of what you would like to see happen vs what happens now?


I've been doing a lot of shell commands while trying to get a decades worth of digital photos into a consistent state in a standardized file formats and folder hierarchy. So I do a lot of copy/paste of things like

/Top/next/last/file_12345.jpg

I'd like to grab these strings with a single double-click, but that doesn't work with Terminal.app. Double-clicking on "last" just selects "last". I've just tried iTerm and it selects the whole string right out of the box, as well as provide a list of word-delimiter characters to customize behavior, and a 'click-to-copy' option. Other than that, I don't care for it much, the fonts all look bad on my display. I greatly prefer Terminal.app in general.

As a side issue, is it possible to make Terminal.app 'click-to-copy' behavior, so you don't have to Ctrl-C to put the string in the Clipboard?

Apr 15, 2010 6:58 PM in response to etresoft

I just downloaded iTerm and I'm quite underwhelmed. People have been singing its praises for a long time, but I don't know why. I'm sticking with Terminal.app.

No problem. I like some Terminal.app features too. But for my Linux/Solars/AIX/Windows software development, iTerm is more productive for me.

iTerm features I like start with is the ability to customize what a double-clickable word is. I dislike precision click and drag selection, so this helps a lot in my environment, as I can customize my most common character strings (file path names) so double-click selects them for me.

Another is the ability to have anything selected automatically copied into the clipboard. Combine that with the middle mouse button pastes the clipboard (or a 9 button mouse customized to paste with a selected button), and you have very fast copy and paste. I know it is an aquired taste, but for me, that speeds things up a lot.

The Bookmarks where I can configure the creation of new tabs that automatically ssh into the remote system I configure into the Bookmark. I have maybe 30 different systems I need to connect with from time to time. In one case it is a Sun SPARC remote console via telnet, that I have scripted using 'expect' to make and complete the connection. All I need to do is select that bookmark and I'm into the console.

The ability to associate a hotkey (Commmand-Control-Letter) with a Bookmark entry makes opening a new tab session very quick and easy.

I first started using iTerm years ago, because it had Tabbed windows. Eventually Terminal also got Tabbed windows as well, but by that time, I found the above 4 features and they are just too much of my daily work flow that I'm unwilling to give them up.

But anyone that uses the Terminal infrequently, or has a totally different workflow may find Terminal a better choice. And there are some good xterm, rxvt, and other X11 based terminal emulators that someone else may prefer. It is all good, especially if it aids your work flow.

Apr 15, 2010 7:14 PM in response to panomanic

Other than that, I don't care for it much, the fonts all look bad on my display. I greatly prefer Terminal.app in general.

You can change the font if you like. I personally have been using BitstreamVeraSansMono-Roman 13. I do not remember if it is part of Mac OS X, part of iTerm, or if it is a font I downloaded from the web. The point is, you can change the font.
As a side issue, is it possible to make Terminal.app 'click-to-copy' behavior, so you don't have to Ctrl-C to put the string in the Clipboard?

Again, as far as I know, Terminal cannot do that either. However, if you have a mouse with lots of extra buttons, like one of the Logitech mice, you can program an extra button to copy and one for paste, so you do not need to have your hand leave the mouse.

Apr 16, 2010 4:03 AM in response to panomanic

It sounds like what you are trying to do isn't well suited to a mouse-based interface.

I suggest something like this:
find /Top | pbcopy

then, open a new window in your favorite text editor and paste. Use global search and replace (with regular expressions) to transform each path into an mv command. When you are all done, save the window as a new file and execute it with sh. I do this kind of thing all the time.

Apr 16, 2010 4:26 AM in response to BobHarris

BobHarris wrote:
Another is the ability to have anything selected automatically copied into the clipboard. Combine that with the middle mouse button pastes the clipboard (or a 9 button mouse customized to paste with a selected button),


Wrong way, Corrigan! You're not up on current events. Apple is getting us back to single button mice. No way would I give up my Magic Mouse. My newest computer doesn't have a mouse at all - or a keyboard for that matter.

But anyone that uses the Terminal infrequently, or has a totally different workflow may find Terminal a better choice. And there are some good xterm, rxvt, and other X11 based terminal emulators that someone else may prefer. It is all good, especially if it aids your work flow.


I just submitted a feature request to Apple to add full path selection. I can see where this would be a useful feature. I still disagree with the general assumption that Mac power users use iTerm. I only have a handful of machines I ssh into, but I do have several Terminal windows open 7-8 hours per day, if not more.

Apr 16, 2010 6:38 AM in response to etresoft

Wrong way, Corrigan!

I did not see a smily on that 🙂
You're not up on current events. Apple is getting us back to single button mice. No way would I give up my Magic Mouse. My newest computer doesn't have a mouse at all - or a keyboard for that matter.

You assume wrong. I own a Magic Mouse. I've used it for a bit with my 27" iMac i7/8GB/1TB system. I prefer the extra buttons on my Logitech MX mouse. But my personal preference does not limit anyone else from their's.

I also got a bluetooth keyboard with the iMac. But I decided to keep using the full sized USB aluminum Apple keyboard I already owned with the iMac. No need to keep changing batteries that way.

The bluetooth keyboad is now paired with the iPad at home.

So if that is not being up on current events, so be it.
But anyone that uses the Terminal infrequently, or has a totally different workflow may find Terminal a better choice. And there are some good xterm, rxvt, and other X11 based terminal emulators that someone else may prefer. It is all good, especially if it aids your work flow.


I just submitted a feature request to Apple to add full path selection. I can see where this would be a useful feature.

An excellent idea.
I still disagree with the general assumption that Mac power users use iTerm.

Where did I say iTerm was for "Power Users"? I think you are trying to put words in my mouth. Please don't do that.

The way I use my Macs at work, is not how others do or should use their Macs.

What I was doing, was explaining why "I" like iTerm. I was not trying to say anything negative about Terminal, nor other terminal emulators, nor about the way people use those environments to their advantage.
I only have a handful of machines I ssh into, but I do have several Terminal windows open 7-8 hours per day, if not more.

Again, if this works for you, or anyone, that is goodness. Terminal has some good features, especially since they added multiple tabbed window support. I really like the ability to expand the window to full screen when I have to view some very wide text output, or do a vimdiff side-by-side difference, and then click on the green button and the window is back to its normal size.

And I'm sure there are other gems in Terminal that I have not discovered, only because I mostly use iTerm. Again, I am not trying to tell anyone not to use Terminal, especially if they like it.

This thread started because the OP could not do what they wanted to do, and iTerm would do it. If they had said iTerm does not resize correctly, or iTerm could not select text and then drag and drop it, I would have suggested using Terminal.

And in another reply, you suggested an alternate approach to the OP's problem, which might be even more powerful and useful to them.

Apr 16, 2010 7:37 AM in response to BobHarris

BobHarris wrote:
Wrong way, Corrigan!

I did not see a smily on that 🙂


Sorry about that. Can I blame it on the iPad? 🙂 I guess not.

I also got a bluetooth keyboard with the iMac. But I decided to keep using the full sized USB aluminum Apple keyboard I already owned with the iMac. No need to keep changing batteries that way.

The bluetooth keyboad is now paired with the iPad at home.


I'm still looking for a decent terminal program for the iPad. iTerm is open source. Maybe I should hack it up.

Where did I say iTerm was for "Power Users"?


You didn't. That is why I said "general assumption." Whenever someone has a question about using the Terminal, someone (not necessarily you) always chimes in about iTerm. This particular feature finally got me interested enough to go past the unimpressive screenshots and download it. Yes, it has a couple of tricks, but in general, those unimpressive screenshots are an accurate representation.

What I was doing, was explaining why "I" like iTerm. I was not trying to say anything negative about Terminal, nor other terminal emulators, nor about the way people use those environments to their advantage.


Not all negatives are bad. Even if people are ranting and raving, they are still talking about it. It would be worse if no one cared.

Again, if this works for you, or anyone, that is goodness. Terminal has some good features, especially since they added multiple tabbed window support. I really like the ability to expand the window to full screen when I have to view some very wide text output, or do a vimdiff side-by-side difference, and then click on the green button and the window is back to its normal size.


I typically use MacFUSE+sshfs just so I can use local editors. Running nedit locally over a relatively slow link is better than any remote editor. Plus, I can then use Apple's opendiff. To make it usable, I wrap it in the following:

#!/bin/sh
# Get a hold of the last parameter.
eval LAST=${$#}
# Now run opendiff with the previous version and the current version.
opendiff ${*} -merge "$LAST"


And I'm sure there are other gems in Terminal that I have not discovered, only because I mostly use iTerm. Again, I am not trying to tell anyone not to use Terminal, especially if they like it.


I'm not trying to be antagonistic (I have the iPad WiFi rants for that 🙂 ). I think it is good to make people think. Even if they don't ultimately agree or take your advice, they might still learn a thing or two. I have benefited from other people doing that to me on a number of occasions.

Apr 17, 2010 10:42 AM in response to etresoft

etresoft wrote:
It sounds like what you are trying to do isn't well suited to a mouse-based interface.

I suggest something like this:
find /Top | pbcopy


Yes I definitely agree, my mini has spent a large portion of its CPU cycles running 'find' lately! But I still find it quite useful to copy and paste entire paths when, eg, creating the regex for find or creating shell commands out of the result. And there are the usual oddities that require manual intervention.

Apr 17, 2010 10:48 AM in response to etresoft

etresoft wrote:

I just submitted a feature request to Apple to add full path selection. I can see where this would be a useful feature. I still disagree with the general assumption that Mac power users use iTerm. I only have a handful of machines I ssh into, but I do have several Terminal windows open 7-8 hours per day, if not more.


Thanks for submitting that request!

Terminal app and 'select-by-word' characters aka 'character classes'

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.