0

I'm using the most recent version of nvim.

When you flip to the next page in a book reading app you see none of the last page only the next page.

Is there a command in nvim to effectivley flip pages like in a book reading app. If not how can this be done.

2
  • 2
    Is a "page" exactly the length of the screen (in lines)? Otherwise, do you have some kind of marker for where the next "page" should start? Do you have an example of where you'd like to use this? There are the Ctrl+F and Ctrl+B keys (in Normal mode) to advance and back one screen... Do those not work for you and how are they different or short from what you want?
    – filbranden
    Mar 22, 2021 at 1:46
  • thanks @filbranden. Ctrl+F and Ctrl+B was not going down exactly one page for me. In essence when I am book reading a text, I don't want to see the same text appear on the screen after thinking I have "flipped a page". I find that confusing. What I am trying to do is show a page and then when I flip to the next page see nothing of what was on the last screen, but see the word after the last word on the previous screen, and all the following continuation text. Solution below works well but not for long wrapped paragraphs which get displayed twice as I outline below.
    – Kes
    Mar 22, 2021 at 15:49

1 Answer 1

3

Not a bug but feature, obviously. From :h scrolling:

A page is the number of lines in the window minus two.

nnoremap <PageDown> <PageDown>2<C-E>
nnoremap <PageUp> <PageUp>2<C-Y>
1
  • thanks. Works very well, except where a very long line of text in a paragraph is wrapped. This line then appears at the bottom of the page and the top of the next page when the page down key is pressed
    – Kes
    Mar 22, 2021 at 15:40

Your Answer

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

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