0

I use (neo)vim with mouse=a and scrolloff=5. Clicking on one of the top or bottom five lines with the mouse causes the screen to jump (so that the new cursor position is more centered), which distracts me. Is there any way to disable "so=5" for mouse-clicking only?

  • I'm not sure how that could work: scrolloff set a minimal number of lines below or above the cursor line. Disabling the option "only for mouse click" would mean that you don't have this minimal number of lines between the cursor line and the edge of the screen but how would vim know when to set this minimal number of lines again? – statox Apr 7 at 17:25
  • @statox preferably at the next vertical movement – 0x539 Apr 7 at 17:25
  • 1
    I'm pretty sure it's not possible to do what you want. You could try to use a mapping like nnoremap <leftmouse> :set scrolloff=0<CR><leftmouse> to disable scrolloff when you click and then remap the motion you want to reenable the option but that seems very impractical. – statox Apr 7 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.