5

When I scroll a whole page up by ctrl-f, and down by ctrl-b, vim reserves 2 lines, and repeats them both in the previous GUI window and the present one. But I expect it not to repeat lines, because now that the "turning" of pages is not a really "turning" but with a small shift, this makes me harder to visualize the new position which it is.

That is to say, if line 1 to line 30 is shown in present window, and to simplify matters suppose none is wrapped, then when I press ctrl-f, the subsequent GUI window will display line 29 to 58. But I want it to show line 31 to 60, and so on. What should I set in .vimrc?

2 Answers 2

4

I like to use the following:

nnoremap <c-f> z+
nnoremap <c-b> z^
1
  • Wow, I know little about z before this. Always learning! Dec 27, 2016 at 6:22
3

It dawned on me that why do I not move page down and further scroll two lines, and same can be said on page up.

" Scroll a page with no repeated lines,
" while default shows two lines in both present and next window
nnoremap <C-f> <C-f><C-e><C-e>
nnoremap <C-b> <C-b><C-y><C-y>

I am finding myself on the right track of being a vim master.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.