0

In insert mode, we can use PageDown/Up or <Shift-PageDown/Up> to scroll the screen. But this fails for terminal mode. How can we achieve this in terminal mode? I'm using zsh on the Arch Linux derivative Manjaro and nvim is started in xfce4-terminal. In xfce4-terminal, <Shift-PageDown>/Up is used to scroll the screen.

Btw, I notice in vim we can't do this either. Is there a reason this is deliberately not implemented or disabled?

4
  • When you're in Terminal-Insert mode (almost) all keys are passed to the child process untouched by Vim. Otherwise PgUp/PgDown should work as expected. Please, clarify your question: what modes exactly "do not work", what kind of Vim you're running (TUI/GUI, Vim/Neovim), what is your OS, terminal emulator, etc.etc. So far your question makes no sense.
    – Matt
    Jun 2, 2020 at 5:23
  • Thank you for prompting me to give more details which now has been added to the question. I think I have made it clear that I was using neovim so I adopted neovim's terminology, i.e., there is only one terminal mode. As a comparison, in vim, we distinguish between terminal-Job (or terminal-insert mode) and terminal-Normal mode. So what bothers me is in neovim's terminal mode and vim's terminal-insert mode, I can't find way to scroll the screen without leaving the mode.
    – Coiby
    Jun 2, 2020 at 7:00
  • I also tried <Cmd> provided by neovim so we can run a command without leaving the mode but neovim doesn't seem to provide an editor command to scroll the screen.
    – Coiby
    Jun 2, 2020 at 7:01
  • You just can't scroll terminal buffer until you're in Terminal-Normal. Hence start your mappings from <C-\><C-N>
    – Matt
    Jun 2, 2020 at 7:10

1 Answer 1

2

You have to exit terminal's insert mode using <C-\><C-N> command and then you can use VIM commands to jump through terminal's history (e.g. gg or <C-u>). You can enter insert mode using i once again.

Kudos for @Matt, who answered this question in the comments.

Your Answer

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

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