psliwka / vim-smoothie

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

Recent updates breaks compatibility with vim-libmodal by Iron-E #42

Open sjacobsson opened 2 years ago

sjacobsson commented 2 years ago

I use IronE's vim-libmodal to define a "scrollmode" where J and K are mapped to smoothie#upwards() and smoothie#downwards() respectively. This stopped working a couple of weeks ago. I put this in my init.vim to reproduce the bug:

let g:plugged_home = '~/.vim/plugged'
call plug#begin(g:plugged_home)
    Plug 'Iron-E/vim-libmodal'
    Plug 'terryma/vim-smooth-scroll'
call plug#end()

let g:smoothie_no_default_mappings = 1 

nnoremap <Leader>s :call <sid>scrollMode()<CR>
nnoremap g^U :call smoothie#upwards()<CR>
nnoremap g^D :call smoothie#downwards()<CR>
let s:scrollModeRecurse = 0
let s:scrollModeCombos = {
        \'j': 'normal ^E',
        \'J': 'normal g^D',
        \'k': 'normal ^Y',
        \'K': 'normal g^U'
        \}
function! s:scrollMode()
        let s:scrollModeRecurse += 1
        call libmodal#Enter('SCROLLING', s:scrollModeCombos)
        let s:scrollModeRecurse -= 1
endfunction

Expected behaviour: Pressing s puts me in scrollmode. Pressing J smoothly scrolls me down half a page and K smoothly scrolls me up half a page.

Actual behaviour: Pressing s puts me in scrollmode. Pressing J once doesn't do anything. Pressing J twice unsmoothly scrolls me up a page.

If I revert vim-smoothie back to commit 10fd0aa57d, the bug is no longer present.