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.

I certainly know it's possible to make the mouse work in Vim on a remote session to a Linux machine from my Mac, but I haven't figured out just how.

Daily vim gives a tip on making it work but if I try to set 'mac-ansi', for example, I get an error saying I can only specify values beginning with builtin_ (riscos, beos-ansi, etc). I've tried using ssh -X, combined with set mouse=a and set term=builtin_anso for example, but with no success with or without combining them.

I'm using Snow Leopard and attempting to use the mouse on a Debian machine with vim 7.1.314. I've had a look at the documentation but can't make it work. Any tips?

share|improve this question

migrated from stackoverflow.com Jan 20 '10 at 15:52

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

    
The advice on that daily vim post is flat out wrong when it comes to the 'term' option. There are very few circumstances where one should be changing that option in Vim instead of making the terminal set the correct value for $TERM. Spectral's comment is right. –  jamessan Mar 31 '10 at 19:13

4 Answers 4

up vote 12 down vote accepted

I don't think that Terminal.app supports xterm mouse reporting which is needed to make the mouse work. There are a few options to getting a terminal with mouse reporting functionality.

  • iTerm is an alternative terminal program that support mouse reporting
  • MouseTerm is a hack to add mouse reporting to Terminal.app but I've not tried it and don't know how well it works
  • You can also install X11 and use a real xterm

Once you've got one of those going, :set mouse=a (you might also need to :set term=xterm) and you should be in business.

share|improve this answer
1  
MouseTerm solved the problem. They currently support mouse clicks and scroll events. I just installed SIMBL + MouseTerm and ran set mouse=a in Vim on my remote machine, and it worked. –  Jonatan Littke Jun 13 '11 at 21:02

To use Terminal.app with a mouse you need to use Alt-click instead of click.
For example, in vim set mouse=a then use Alt-click to position the cursor.

This works through ssh, although it doesn't allow resizing of (vim) windows. You also lose the ability to cut from other windows and paste into the terminal window.

share|improve this answer

I don't have the answer, but I can share what I have learned in my months long search for the answer. I'm a heavy user of vim and GNU screen over ssh. Somewhat ironically, I swear by those programs because I can use them remotely without a mouse, but I have nearly abandoned OS X because it doesn't provide an easy way for me to use them remotely with a mouse.

Anyhow, here is what I have turned up:

  • xterm running under X11.app can be made to report mouse events and work as desired. Unfortunately, xterm lacks many of iTerm and Terminal.app's features. Doing something as simple changing the font in xterm requires a bit of black magic.
  • iTerm can supposedly accommodate the desired functionality, but I have never gotten it to work. iTerm also suffered from major performance issues when I jumped ship to Terminal.app a couple months ago. Screen updates happened slowly, and it would take up 25% CPU just sitting there doing nothing.
  • I actually tried using a stripped down Ubuntu VM running under VMWare as my terminal app. I set it up to boot into a fullscreen Gnome-Terminal with fluxbox as the window manager. I gave up on that solution because it didn't play nice with Spaces and the overhead of running VMWare.

Now I just never stray far from a real Linux box occasionally use vim through Terminal.app to keep me honest - if I can't remember the navigation keystrokes, I might as well be using Visual Studio.

share|improve this answer

On top of Geoff's answer, here's another possible solution:

MacVim + NetRW for vim.

MacVim has built in mouse support, and NetRW is a vim module that allows remote editing using vim scp://host/path/to/file. So just start MacVim and connect to the file, edit it and save it remotely.

You may also be interested in tweaking the GUI a bit, see my related question on SO.

share|improve this answer

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.