Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a native option (ie. without installing extra soft/package/plugins) to enable mouse support in the Terminal app?

Actually, I'm using a lot vim with the option set mouse=a (activating mouse features).

But it seems that Terminal don't support all xterm's features.

It appears (after some googling) that Terminal had once the mouse support, but I wonder where did it go.

N.B: I really want mouse support in Terminal, not only for vim, so please, don't suggest MacVim :]

share|improve this question

migrated from stackoverflow.com Mar 28 '10 at 20:05

This question came from our site for professional and enthusiast programmers.

    
What does xterm support that Terminal doesn't? Copy-on-highlight and middle-paste? –  Ignacio Vazquez-Abrams Mar 28 '10 at 8:44
    
The mouse reporting. It's the real mouse support. The copy-on-highlight, middle-paste, etc. are not really related to Terminal as far as I know. –  avetis.kazarian Mar 28 '10 at 9:25
2  
copy-on-highlight and middle-paste ate Terminal related - in that Terminal does not do them - you could try iTerm for those –  Mark Mar 28 '10 at 9:53
    
@Mark: I checked it and liked it. Though Terminal handles far better bold characters. Anyway, thanks. –  avetis.kazarian Mar 28 '10 at 11:32
2  
@Arjan: some interactive CLI apps support the mouse; for instance, positioning the text cursor in vim. –  ELLIOTTCABLE Nov 21 '11 at 16:40

6 Answers 6

up vote 64 down vote accepted

I found the answer!

A friend told me the trick, it's so easy that I'm ashamed.

Just press alt key and click! (with mouse support previously activated in vim)

share|improve this answer
7  
I’ve been an OS X power user for what feels like half a century, and I never knew this. I am extremely impressed. I wish I could give you a hundred up votes instead of one. –  ELLIOTTCABLE Nov 21 '11 at 16:42
3  
Anyway to disable the requirement to use alt? –  philfreo Jul 9 '12 at 13:56
6  
It's not the same, for me anyway. Often I click on a character and the cursor ends up somewhere else, sort of near it. It also doesn't work for switching tabs in vim. It also seems not to work so well for switching windows in tmux. –  andyortlieb Jul 14 '12 at 11:35
1  
@andyortlieb: that's why I moved to iTerm2. –  avetis.kazarian Jul 16 '12 at 15:04
1  
no worky for me. –  Mike Graf Jun 6 '13 at 21:32

As an alternative to using Alt-click to set the cursor in vi with OS X Terminal, I would like to suggest using iTerm 2:

I wanted mouse support in Terminal vi (Mac OS X 10.7 Lion), but there's no support for scrolling with the scroll wheel. I ended up switching from Terminal to iTerm 2, which supports vi scroll wheel scrolling, and you don't need to hold down alt to set the cursor.

If you don't use some of the more advanced features in Lion's Terminal app, you may be quite happy with iTerm 2.

Edit: To enable mouse support in Vim when using iTerm 2, add the following line to your .vimrc:

:set mouse=a
share|improve this answer
    
How can you scroll down using the mouse wheel? It just goes up the screen buffer, and you can get that in Terminal.app by disabling the use of the alternate screen buffer, e.g. in vim using set t_ti= t_te= in your ~/.vimrc. –  Daniel Beck Jul 11 '12 at 18:26
    
I did need to configure :set mouse=a in my .vimrc -- that's the normal way to enable mouse support in Vim, but it seems that mouse input is eaten by Terminal.app. Scrolling up and down in a text file with the scroll wheel seems to work perfectly in iTerm2.app, however. –  Steve HHH Jul 11 '12 at 22:03

It appears that on OS X 10.4 (I'm not sure about 10.5) you can enable mouse support. Open the Terminal, then click on Window Settings. Click Emulation from the drop down list and then check the option "Click to position Cursor".

share|improve this answer
1  
Actually, there's nothing such as "Window Settings" in Terminal preferences on 10.5 neither on 10.6. All you can to in the "Window" tab is change the background color, scroll size, title and window size. –  avetis.kazarian Mar 28 '10 at 9:20
1  
It must be only on 10.4 then... –  Joe D Mar 28 '10 at 9:57
    
+1 I have it on 10.4.11 –  sixtyfootersdude Mar 30 '10 at 3:49
1  
This isn't exactly mouse support. What this will do is allow you to option click a part of the terminal, and Terminal.app will calculate how many line up/down/left/right characters are needed to move the cursor there, and then type them. Very useful but not what the OP wanted I don't think. –  Josh Apr 2 '10 at 22:27

Note that Mac OS X does have xterm in addition to Terminal.app. I couldn't tell from your question if you were aware of this. But if you have the X11 package installed you can fire up an xterm window and mouse support works just fine.

share|improve this answer

MouseTerm seems to be the perfect SIMBL plugin for those who want decent mouse support in their Mac OS X Terminals. As of May 2013, the latest version (1.0b1 released in Jul 2011) states it adds the following features to OS X's standard Terminal application:

  • Mouse button reporting.
  • Mouse scroll wheel reporting.
  • Simulated mouse wheel scrolling for programs like less (i.e. any fullscreen program that uses application cursor key mode).
  • Terminal profile integration (with preferences dialog).

I'm using tmux and vim with it, and it allows me to not only click (without the option key!) but also scroll and drag inside them with little configuration: e.g., :set mouse=a for vim, and tmux set-window-option mode-mouse on. It's easy to toggle mouse reporting (with a single key combination ⇧⌘M, or from the Shell menu), so there's nothing to lose to have it installed.

(Caveat: Clicking/draging in tmux copy-mode isn't working as I expected, though.)

share|improve this answer
    
Another caveat - I have noticed that after I first start Terminal after logging in, the mouse support does not work at all until I quit Terminal and start it again. –  Michael Jun 11 '13 at 15:49
    
@Michael: Your symptom sounds familiar to the old SIMBL Issue 13. Updating SIMBL would probably fix that. (0.9.9 or 0.9.9b) –  netj Jun 13 '13 at 17:28
    
tried 0.9.9, didn't work. tried the AppleScript in comment #23, got "Expected end of line but found identifier" (changed "Snow Leopard" to "Lion", but I am running Lion...) –  Michael Jul 5 '13 at 22:24
    
also tried 0.9.9b (Patched for Lion), and that doesn't fix it either. still have to restart Terminal before it will accept mouse events. –  Michael Jul 5 '13 at 22:30

You can set up xterm emulation in advanced preferences, at least in Terminal 2.4 (OS X 10.9.3). This enabled proper mouse support for me.

share|improve this answer
    
It doesn't work (please be sure to test with vim and tmux). –  avetis.kazarian Jul 25 at 9:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.