New answers tagged

2

Normal mode For normal mode, rather than remapping scroll commands, I would use an autocommand: augroup KeepCentered autocmd! autocmd CursorMoved * normal! zz augroup END Insert mode For insert mode, as you've discovered, simple autocommands won't suffice. Instead, note that there are very few keystrokes that can cause the cursor to change lines when in ...


4

If you're willing to bring a function into the mix I whipped this up. I won't pretend it's super pretty or slick but it seems to do the trick... func! ModifiedZZ() norm! zz let max_gap = 10 let adjust_trigger = 5 let to_scr_end = winheight(0) - winline() let to_buf_end = getpos('$')[1] - getpos('.')[1] if to_buf_end < ...


Top 50 recent answers are included