tags:

views:

2146

answers:

5

I've been googling around trying to figure out if it's possible to use my mouse wheel to scroll while inside Vim in Mac's Terminal, with no luck. It seems as if only X11 or iTerm support this.

Before I give up, I thought I'd try the geniuses here to see if anyone knows a way to do this. So, does anyone know if I can set that up?

Or should I seriously consider using a different terminal application?

+1  A: 

Use gVim, which gives you a text editing environment in a window you can scroll. Terminal is not involved when using gVim.

Greg Hewgill
Not really relevant - he might be accessing vim on another machine (through ssh) - In any case, on a mac, macvim is the preferred graphcial version http://code.google.com/p/macvim/
thrope
+2  A: 

You can read this article, but I'm pretty sure since the default terminal in Mac OS X has a built-in scrollbar, the mousewheel commands automatically go to it. You could definitely use gVim as suggested in the previous answer. I find that I don't generally want to use the mouse in Vim though as it takes my hands off the keyboard.

I just use 50j to go down and 50k to go up. Not exactly scrolling, but it works pretty well.

Topher Fangio
Thanks, that's not exactly scrolling but I think that's better since my hands are always on the keyboard.
hora
@hora - Yeah, scrolling would definitely be nice, but unfortunately, I don't think it's doable.
Topher Fangio
Or use CTRL+f and CTRL+b to move forward and back by one screen at a time. Or CTRL+d and CTRL+u to move up and down by half a screen.
Dan Dyer
It's not just scrolling - you also get the ability to mark visual selections with the mouse, move window boundaries etc. It basically makes a graphical program redundant and is great for when you're working on a remote machine.
thrope
@thrope - Very true, I use that quite often actually. `v` for visual mode and then select the text I want. However, I usually want an entire line or set of lines, so, to avoid newline pasting problems, I generally just count the lines and hit `dd` to delete them. A bit slower sometimes, but it's what I've gotten used to.
Topher Fangio
+1  A: 

I'm using xterm in X11 (XQuartz 2.3.4) and vim works very fine with mouse and also suport 256 colors.

Here is the ~/.Xresources I use to make my xterm nicer in X11:

XTerm*faceName: Lucida Sans Typewriter Regular
XTerm*faceSize: 9
XTerm*utf8: 1

xterm*saveLines: 1000
xterm*jumpScroll: true
!xterm*awaitInput: true
!xterm*multiScroll: true

XTerm*scrollBar: false
xterm*scrollbar*thickness: 16
xterm*rightScrollBar: true

XTerm*foreground: white
XTerm*background: grey10
!XTerm*background: black
XTerm*cursorColor: yellow

xterm*visualBell: false

xterm*loginShell: true

Little tips, to remove the bell sound in X11's xterm type this command:

xset b 0
XPac27
I've tried xterm, not a big fan though I dunno why, there's something about it that puts me off. Maybe I'll give it another shot.
hora
The only thing that changes is for copying and pasting. Paste done by mouse's middle click (or alt + click) and copy is done just by selecting some text. Of course in vim you'll have to disable the mouse to be able to copy something outside X11 or paste something from outside X11 or vim while override X11's mouse behavior.
XPac27
+1  A: 

I would recommend using iTerm - it has so many advantages over Terminal eg Mouse support, 256 colors, sensible copy and paste (auto-copy, word/url selection with double click, middle click paste)...

thrope
Are there built in colour schemes in iTerm? How do I change the colours, can't seem to figure it out... The 'show session info' dialogue doesn't seem to let me save different profiles.
hora
Yeah the configuration setup is a bit funny... Go to Bookmarks -> Manage Profiles -> Display Profiles and you can setup colors. Then you go to Bookmarks -> Manage Bookmarks and setup default or whichever one you want to use the display profile you want.
thrope
+9  A: 

Here's the right answer:

http://bitheap.org/mouseterm/

Use MouseTerm (and do make sure to install SIMBL first!) and scrolling will work like a charm, even remote, using Mac Terminal.

Jonatan Littke
Wow, that's exactly what I was looking for. In the meanwhile I've gotten used to NOT using my mouse, but this is still useful.
hora