psliwka / vim-smoothie

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

how to handle remap? #29

Closed breuerfelix closed 3 years ago

breuerfelix commented 3 years ago

hey i got a more complex example of remapping and can't get my head around...

noremap <C-f> <C-u>
nmap <C-u> :q<CR>

which working totally fine since C-f is not following the quit command. but with smoothie -> it does not work anymore since i would need to nmap the c-f command but then it follows my quit command.

any way i can custom map the scrolling in the plugin?

subnut commented 3 years ago

any way i can custom map the scrolling in the plugin?

Just overwrite it in your .vimrc.

I can help you better if you tell me exactly what do you want to happen when you press <c-f>

breuerfelix commented 3 years ago

@subnut i try to be more precise.

i noreremaped c-f to c-u. that means c-f scrolls up because scroll up is default mapped to c-u. i remapped c-u to quit my current file. since c-f is a noremap, it won't follow the remap of c-u and just scrolls up instead of quitting the file. that is as expected. but in another issue it says, that you have to nmap your custom key to c-u and not noremap it, because otherwhise it can't follow the plug map which gets set in the plugin.

but i found out that i can just custom map it to the plug commands instead of c-u like so:

nmap <silent> <C-f> <Plug>(SmoothieUpwards)

maybe this helps someone else.
i was searching through the issues and readme first and was not actually having a look at the vim source file. my bad.

subnut commented 3 years ago

Happy that you fixed it yourself :+1:

Just one thing more... why did you use <silent> in the mapping? Could you please try removing it and tell me if there's any difference?

breuerfelix commented 3 years ago

@subnut well i usually it disables any output in the command line bar so i always put it in front of commands i often use. But with vim-smoothie it does indeed nothing since there is no output at all. so if you add it or not, doesn't make any difference :)