What is the best way to do smooth scrolling in vim?

Here's another vim script from 2008: vim.org/scripts/script.php?script_id=2183.

This script is giving me inconsistent results (i.e. Non-smooth, dramatically varying scrolling speed) as well. Not sure what in the display path is creating performance issues.

I'm using gvim 7.2 from debian testing. – Drew Wagner Oct 31 '10 at 22:44.

There is a simple remap hack in vim's tips. Txt: Smooth scrolling *scroll-smooth* If you like the scrolling to go a bit smoother, you can use these mappings: :map :map.

Scroll option seems preferable because you could even create an au command that changes it automatically when window height changes.( I guess you could do something like that with this mapping method also, but scroll option simplifies things.) – Herbert Sitz Oct 31 '10 at 21:21 Actually, automatically setting scroll variable is one of the options I was considering too. As you mention, it needs to be appropriate to the window size. The scroll variable defaults to 1/2 the window height, but it doesn't seem to expose a way to change that fraction; you can only change it in terms of the number of lines.

You might also have to set a smaller value for scroll than if you also had some sort of smooth scrolling, since your eyes won't have any intermediate scrolled states to improve persistence of vision. – Drew Wagner Oct 31 '10 at 22:15 Update: I have tried a few variations on this answer, i.e. :map 2222222 :map 2222222 and the visual effect seems heavily dependent on how much stuff is on screen.I.e.

The speed can vary by something like 4X. – Drew Wagner Oct 31 '10 at 22:31 To clarify, c-d and c-u will scroll by whatever the 'scroll' option is set to. Default is 1/2 of window height, but you can set it to whatever you want.

If you want to make a new value depend on window height then use the 'winheight("%")' function, which returns number of lines in window. So, e.g. , the command ':set scroll = winheight("%")/3' would make c-u and c-d scroll 1/3 of window height. – Herbert Sitz Oct 31 '10 at 23:30 :set scroll=winheight("%")/3 resulted in E521: Number required after = – Drew Wagner Oct 31 '107 at 2:48.

Here is a smooth scroll vim script from 2006: vim.org/scripts/script.php?script_id=1601.

This isn't exactly smooth scrolling, but it's how I handle not losing context when jumping pages. Set so=7 'scrolloff' 'so' number (default 0) global {not in Vi} Minimal number of screen lines to keep above and below the cursor. This will make some context visible around where you are working.

If you set it to a very large value (999) the cursor line will always be in the middle of the window (except at the start or end of the file or when long lines wrap). For scrolling horizontally see 'sidescrolloff'. NOTE: This option is set to 0 when 'compatible' is set.

I use Ctrl-F and Ctrl-B heavily and I don't like pressing Ctrl-key, so I have remapped some normal keys as below: nnoremap nnoremap t Likewise, for Ctrl-Y and Ctrl-E, I have mapped these keys: " Smooth scroll up one line nnoremap r " Smooth scroll down one line nnoremap f In addition, I use the following: set mouse=a " Enables use of mouse in vim too, if you really need it. Imap ii " Easy to go to Esc mode from insert. I don't use half-page up/down, so never bothered to remap.

With such similar settings, smooth scrolling and getting around the buffer is like breeze. You never have to take your fingers off the keyboard.

Thanks for sharing, but "smooth scroll" means that the text on the screen smoothly shifts up or down in response to a command. – Drew Wagner Nov 9 '10 at 18:23.

What I do is I set the keyboard repeat to very fast, about 120 chars / second, and the delay small. Then I map to 4j and to 4k I navigate up and down source code using j and k which moves the cursor up and down nice and quick, pretty smooth. But here's the good part, and this works on Linux, not Windows.

For a number of years now, X11's keyboard input works in such a way that when you press and hold j it obviously starts putting out j characters. But when you then keep holding down j and then also press the ctrl key, X11 starts putting out c-j characters without you having to re-press the j key. Then when you let go of the ctrl key and still keep on pressing j, X11 continues to put j's again.So j makes the cursor start moving nice and smooth downwards, and you can periodically hit ctrl without letting go of j to give it a boost, a jolt.

Also, I do what Devin does, and I set scrolloffset to 5. Lastly, I swap ctrl and cap lock. The default position of the ctrl key is completely retarded (no offense intended).

It makes you have to rotate your left hand. I almost never use caps lock, so I swap them. Then my left pink finger can reach the ctrl key without any yoga moves.

These things have worked for me for years. I only use vim, never gvim.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions