smoothPageScroll is a Vim plugin that offers smooth page scroll.
I found scrolling the number of winheight() is not always correct, because the file could have wrapped lines. Let's say if your window height is 40, but you only see 35 actual lines because you have 5 wrapped lines. Then by scrolling the number of winheight(), 5 lines would be over-scrolled. This script won't skip the extra lines for having wrapped lines.
This script also emualtes one of VIM's normal < PageDown > or < PageUp > behaviors: which is to display first or last 2 lines from the previous screen after scrolling, unless it reaches first or last line, or the current window is showing 3 lines or less.
Copy the script in your plugin directory.
1) call them directly
:call SmoothPageScrollDown() to scroll page down
:call SmoothPageScrollUp() to scroll page up
2) or remap < PageDown > and < PageUp >
map < PageDown > :call SmoothPageScrollDown() < CR >
map < PageUp > :call SmoothPageScrollUp() < CR >
Personally, I remapped and keys, since in non-insert mode is not that useful (just move the cursor one position right). And many programs such as web browsers or Adobe Reader use space key to scroll page.
map :call SmoothPageScrollDown()
map :call SmoothPageScrollUp()
But remapping < S-Space > may not work on certain console or platform. So you might have to find another candidate, such as < M-Space >, < C-Space > or something else.
If the scrolling speed is too fast, you can delay scrolling speed more by adding g:smooth_page_scroll_delay in your [._]vimrc. Following line will delay extra 5 milliseconds per each line.
let g:smooth_page_scroll_delay = 5
What's New in This Release:
· added a function to delay scroll speed