sexy_scroller.vim : Smooth animation of the cursor and the page whenever they move, with easing.
| script karma
Downloaded by 374
Comments, bugs, improvements
script versions (upload new version)
|sexy_scroller.vim - Smooth animation of the cursor and the page whenever they move, with easing.
By joeytwiddle, inspired by Terry Ma's smooth_scroll.vim, one of many Ctrl-U/Ctrl-D scrollers.
Not to be confused with daylilyfield/sexyscroll.vim which lacks easing.
I have not yet seen any other smooth-scrolling scripts that provide easing, operate on general movements, or use winrestview instead of keymappings/cursorhold.
Usually when you scroll the buffer or motion to a different part of the
document, Vim will jump there immediately. But with SexyScroller, Vim will
scroll to the new position smoothly. As well as looking pretty, this
provides you with visual feedback about the distance you have travelled.
Instead of specifying the scrolling *speed*, SexyScroller asks you to
specify how *slow* you want scrolling to be. You can store these options in
your .vimrc once you are happy with them.
Set the time it takes (in milliseconds) for the buffer to scroll one line or
:let g:SexyScroller_ScrollTime = 10
Set the time it takes for the cursor to travel one line.
Probably only visible if you have `:set cursorline`. Set it to 0 to never
animate the cursor.
:let g:SexyScroller_CursorTime = 5
(I like to pretend the cursor is "lighter" than the buffer.)
Set the maximum amount of time that longer scrolls can take:
:let g:SexyScroller_MaxTime = 500
Choose the easing style (how scrolling accelerates and decelerates):
:let g:SexyScroller_EasingStyle = 2
- 1 = start fast, finish slowly (like 2 but less so)
- 2 = start very fast, finish very slowly (recommended, default)
- 3 = start slowly, get faster, end slowly (sexy)
- 4 = start very slowly, end very slowly (like 3 but more so)
- ? = constant speed (dull)
Interrupts the animation if you press a key. Resumes the animation if they
key you pressed causes further scrolling, otherwise just jumps directly to
the destination. Resuming animation looks best with EasingStyle 1.
:let g:SexyScroller_DetectPendingKeys = 1 / 0
This command is provided to enable/disable the scrolling:
For eye candy, try MaxTime=1200, EasingStyle=3 and increase ScrollTime as
well. This can help to visualise the distance travelled when moving through
Power users may prefer to lower MaxTime to 400, and set EasingStyle 1 or 0.
This will make Vim feel more like normal (more responsive).
Works pretty well in the general case, without having to configure custom mappings, but there are a few known issues which are documented in the script itself.
The most noticeable is that if you have 'hlsearch' enabled, scrolling does not occur until *after* you leave search mode! Although it works fine on n and N.
Older versions of the script may be found at https://github.com/joeytwiddle/sexy_scroller.vim
|Drop the script in your ~/.vim/plugin folder|
Click on the package to download.
ip used for rating: 188.8.131.52