How do I scroll through a terminal using Vim 8.1's new terminal/termpack support? [closed]

I love the new terminal support that Vim 8.1 offers and I like that up/down are mapped to the terminal, so that you can select prior commands. How can I scroll up and down the terminal however? Currently, in my GDB program output window I see characters like this:

^[[A^[[A^[[A^[[A^[[B^[[B^[[B^[[D^[[D^[[

And in the terminal window it just moves between prior commands.


Solution 1:

You have to switch to 'Terminal-Normal mode' with Ctrlw, N (that's Ctrl-w, capital N). Then you can use the usual Vim commands to move around, cut, copy and paste.

Once finished, press either i or a to resume using the terminal as before.

Solution 2:

I do this:

tnoremap <c-b> <c-\><c-n>

And then <C-b> whenever I need to scroll back up, using gg to go all the way up, then G to come back down, (or <C-F> for page by page). I press 'i' or 'a' from any page to enter commands in the shell. Simplicity itself.