Take the 2-minute tour ×

Is it possible to get smooth scrolling (using the mouse scroll wheel or macbook touchpad) within a terminal on Mac OSX (Lion)? Furthermore, could I do this within vim?

I find that smooth scrolling aids the reading of code, I don't like it when you can only scroll in discrete lines as opposed to continuous pixel-by-pixel scrolling.


share|improve this question
You may have a better experience if you use a Vim application instead of using it within a terminal session (code.google.com/p/macvim, macvim.org/OSX). Is there a reason you need to use it within a terminal? –  Chris Page Jul 20 '12 at 6:20
MacVim doesn't provide smooth scrolling either. –  romainl Jul 20 '12 at 7:08
Hi @romainl. I wonder how vim behaves if the buffer size (windows size) is really big (i.e. the size of the whole file). GOtta test this out. Then we could put a vim buffer inside a smooth scrolling GTK (or QT) widget and scroll the entire vim buffer inside the widget smoothly. This would have the added benefit that the cursor could be easily hidden like with modern editors. When the user moves the cursor, the widget would know (using the same API gVim uses) and recenter the scroll position accordingly. –  trusktr Oct 13 '13 at 16:38
(cont'd.) Window splitting could even be accomplished by duplicating vim's full-file-length output into a new widget and scrolling the widget smoothly to the appropriate position. This would all require some simple arithmetic and good knowledge of a nice widget toolkit. Window splitting (horizontal and vertical) and scrolling and resizing the widgets would be the. The rest would be a piece of cake to do (menus, tabs, things that gVim and qVim already do). –  trusktr Oct 13 '13 at 17:37
(cont'd.) This has the potential to vastly improve vim's performance too. Think about this: every time you scroll the console vim or g/qvim windows (currently), vim has to rewrite almost every character on the screen. If the vim buffer was full length, and scrolling was handled independently by a smooth-scrolling widget, vim would only need to update one line's worth of characters at a time whenever you move the cursor to a new line (or better yet, a single character when you move forward or backward one character). This would be a HUGE performance advantage for vim! –  trusktr Oct 13 '13 at 17:44

2 Answers 2

I'm using iterm2, and I'm finding very nice functionality using vim 7.3 in the terminal with the following options:

set mouse=niv #or set mouse=a
set clipboard=unnamed

EDIT: set mouse=a also seems cool to use as indicated by the other suggestion.

What this does is automatically switches you into either visual mode from normal while selecting text, or into the mode that says -- (insert) VISUAL -- from insert mode. This also has the handy advantage over not setting these modes at all in that when you've got line numbers or relative line numbers, it'll go ahead and copy those numbers you likely don't want to copy. When it drops you into mouse-enabled visual mode this way, it avoids copying those line numbers, as it works to control the visual mode selection rather than the native terminal's selection (which gets suppressed). Scrolling works just fine throughout, keeping in mind that it selects everything from where you had started the selection to the bottom of the screen. Forget about ctrl+c/ctrl+v in vim - You use the vim yankypasta commands (y, yy, p, etc) to copy to the system clipboard:


Again, iterm2 -- osx's built in terminal is trash. I don't really see your beef with line-by-line scrolling, as I'm happy with how this simply functions as vim should, but maybe it's for similar reasons to why I can't watch other people play video games out of motion sickness or why flourescent light and CRT monitor flicker messes with people's heads to the point of migraine. Try adjusting the refresh rate on your brain, you can feel the knob if you press into your temple hard enough and turn.

share|improve this answer

I don't really agree with you but here is a Terminal.app plugin that does what you want and more.

You might need to add

set mouse=a

to your .vimrc. See :help mouse for more info.

share|improve this answer
Unfortunately the plugin requires SIMBL, which isn't available for Lion –  Eddy Nov 14 '11 at 20:48
I didn't know because I don't have Lion. MouseTerm is the only way to add mouse scrolling to Terminal.app I've ever heard of. It appears that some people have reported limited success in using SIMBL on Lion, did you try? Also I see that iTerm2 provides "mouse reporting" and scrolling but it will probably scroll line by line. As a side note I hardly scroll (up/down/j/k) anymore: I find /, ?, fF, tT and <C-f>/<C-b> a lot more useful. –  romainl Nov 14 '11 at 21:30
Note that these make the mouse-wheel scrolling work, but they don’t address the primary issue: “I don't like it when you can only scroll in discrete lines as opposed to continuous pixel-by-pixel scrolling.” –  Chris Page Jul 20 '12 at 6:21
This type of scrolling (line by line) is hardcoded in Vim. There's thankfully no way around it. If one really needs it one should insist on it with carefully worded arguments on vim-dev or provide a patch. –  romainl Jul 20 '12 at 7:08
The reason why I want smooth scrolling is that I tend to lose my place when scrolling through lines discretely. It's hard to explain. Maybe it doesn't effect everyone but it does for me –  Eddy Jul 20 '12 at 9:07

Your Answer


