Vim and mouse with ssh from Mac to Linux

Solution 1:

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.

Solution 2:

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.