psliwka / vim-smoothie

Smooth scrolling for Vim done right🥤
MIT License
988 stars 27 forks source link

Non-backwards-compatible updates #35

Closed ds2606 closed 2 years ago

ds2606 commented 2 years ago

Vim-plugged just updated my local vim-smoothie codebase, and my scrolling keybindings seem to have broken.

I had these bindings:

noremap <silent> - :call smoothie#downwards()<CR>
noremap <silent> = :call smoothie#upwards()<CR>

They now do not work, so I tried updating them to

noremap <silent> - :call smoothie#do("<C-U>")<CR>
noremap <silent> = :call smoothie#do("<C-D">)<CR>

As per the README, but they still do not cause scrolling. (There could be a lot of reasons, one of which could be that coc.nvim also binds C-D / C-U and vim-smoothie's bindings are recursive onto those).

Side note: the README has duplicate lines here:

nnoremap <unique> <C-D> <cmd>call smoothie#do("<C-D>") <CR>
vnoremap <unique> <C-D> <cmd>call smoothie#do("<C-D>") <CR>
psliwka commented 2 years ago

Thanks for reporting this, @ds2606! I just pushed a fix, after which your original bindings should keep working (the update was meant to be backwards-compatible, but somehow I screwed it up). Also, I updated the README to show correctly how to add custom bindings using the new API.

Side note: the README has duplicate lines here:

They're not duplicate ;) The first one adds normal mode mapping (nnoremap), the second one is for visual mode (vnoremap). Unfortunately, AFAIK Vim does not allow to map both at once (without affecting other modes as well, which is not what we want).

ds2606 commented 2 years ago

Thanks @psilwka! And haha sorry I should know better than to miss the v/n difference..

Unfortunately, the scrolling behavior is still much choppier on fc7f0b3 than the last good commit I've identified, which for now is 10fd0aa. I'm not sure why this is, but for now I think I'll need to leave HEAD there.

There seem to be multiple issues that cropped up with the codebase refactoring. One of them is: quick page-downs in succession don't work (e.g. spamming <C-D>) as smoothie fails to recognize the successive keypresses, whereas in fc7f0b3 I could quickly hit <C-D> a bunch of times and vim-smoothie would react to each event (not missing any keypresses). I'm not sure why the overall scrolling seems choppier (I have two terminal windows open side by side, one with vim running at each commit to compare) but some wires seem to have maybe been crossed up in the refactor 🫤