I'd like to use the mouse in vim ONLY for scrolling (not to enable other vim modes or otherwise interact with vim). Using :set mouse=a seems to be an all or nothing operation, can this be altered? Alternatively can iTerm be made to only pass through scroll events and never click/drag events?

Long Explanation: I use vim in iTerm a lot and don't use the mouse. However, inertia scrolling with a trackpad is really nice and a great way to peruse large files. I can :set mouse=a and use the trackpad to scroll and it's great. Now when I click however vim enters visual mode and iTerm will not copy selected text. I would like to retain iTerms ability to select and copy text.

I have thought about setting up vim so that copying in vim will copy in macosx (using pbcopy, I need to do this anyway). This will do the trick when editing local files, but most of the time I'm ssh'd somewhere and editing remote files.

link|improve this question
feedback

4 Answers

up vote 2 down vote accepted

You could use

:set mouse=nicr

It works only with mouse scroll as I've tested.

link|improve this answer
Not quite what I need as while it will scroll in vim, iTerm won't let me select text. I've :set mouse=i so that scroll works in insert mode and iTerm select in normal mode. Close enough, so I'm marking answered. Thanks for the idea! – Jonah Braun Dec 15 '11 at 21:30
feedback

I don't know whether these techniques will work with an iTerm, but take a look at

:help xterm-mouse-wheel
link|improve this answer
feedback

I'm not sure about iTerm but this is achievable with Terminal.app.

  • Scrolling in Terminal.app:

http://ayaz.wordpress.com/2010/10/19/using-mouse-inside-vim-on-terminal-app/ (install SIMBL and MouseTerm)

  • Scrolling only:

    1. Go to terminal;
    2. Preference;
    3. 'Settings' Icon;
    4. 'Keyboard' Tab
    5. 'Mouse...' button;
    6. There under 'Send mouse events for:" uncheck "Left click", "Middle click", "Right click".

Done.

link|improve this answer
feedback

Even better than the accepted answer:

set mouse=a

This allows scrolling and then highlighting gives you a visual block.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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