psliwka / vim-smoothie

Smooth scrolling for Vim done rightšŸ„¤
MIT License
994 stars 27 forks source link

Can it use count? Such as press `4<c-d>` it will <c-d> 4 times? #9

Closed Freed-Wu closed 4 years ago

Freed-Wu commented 4 years ago

it looks like nnoremap <silent> <C-D> :<C-U>call smoothie#downwards()<CR> cannot realize it.

nnoremap <silent> <C-D>      :<C-U>call Foobar(v:count1)<CR>
function! Foobar(count) "{{{
    for l:count in range(1, a:count)
        call smoothie#downwards()
    endfor
endfunction "}}}

Unfortunately it cannot realize it, too.

Thank you very much!

psliwka commented 4 years ago

count has special meaning for native <C-D> and <C-U>, which is honored by vim-smoothie too. It is used to control amount of lines scrolled on each keypress:

The number of lines comes from the 'scroll' option (default: half a screen). If [count] given, first set 'scroll' option to [count].

Fear not, though! <C-F> and <C-B> do not share this behavior, so you can use f.ex. 2<C-F> instead of 4<C-D>. Cheers!