Search code examples
macosvimitermiterm2

Why can't I get vim smooth-scrolling to work on iTerm2 (Yosemite)?


I've wasted too many hours trying to get these things working and this is my final shot at it.

I'm using this plugin: https://github.com/terryma/vim-smooth-scroll

Where I've placed the .vim file in ~/.vim/plugin and added the code on the readme to my .vimrc

When I open vim in iTerm2 and scroll a large file, Ctrl+U/D work the same way as they do by default. But when I use the default terminal that comes with OS X, I can see the file scrolling smoothly.

How do I fix this?

PS: I also tried placing the .vim file in ~/.vimrc/bundle (I have pathogen). Yet no go.


Solution

  • Have you added key bindings to your .vimrc?

    let g:smooth_scroll_duration=50
    map <silent> <c-u> :call smooth_scroll#up(&scroll, smooth_scroll_duration, 2)<CR>
    map <silent> <c-d> :call smooth_scroll#down(&scroll, smooth_scroll_duration, 2)<CR>
    map <silent> <c-b> :call smooth_scroll#up(&scroll*2, smooth_scroll_duration, 4)<CR>
    map <silent> <c-f> :call smooth_scroll#down(&scroll*2, smooth_scroll_duration, 4)<CR>
    
    map <silent> <PageUp> :call smooth_scroll#up(&scroll*2, smooth_scroll_duration, 4)<CR>
    map <silent> <PageDown> :call smooth_scroll#down(&scroll*2, smooth_scroll_duration, 4)<CR>