I use Vim to edit text files on Linux. Commonly I connect to remote Linux machines using PuTTY from Windows. I use GNU Screen commonly as well. When using Vim inside Screen I am unable to use the Page Up key because Screen interprets it as a command to start copy mode.

I would like to use Page Up for its regular up-paging functionality. How can I configure Screen to do this?

migrated from serverfault.com Aug 28 '12 at 5:25

This question came from our site for system and network administrators.

  • log-in to system as you usually do and type: echo $TERM I'm using PuTTY and connecting to my Linux and able to use PAGE-UP no problem. – alexus Aug 27 '12 at 19:51
  • 3
    you have to configure putty as answered in this thread: superuser.com/questions/94436/… – jfried Aug 27 '12 at 19:52
  • 1
    In Vim, page up can also be achieved using ctrl-u (ctrl-d for page down). Not that that solves your problem... – adamdunson Oct 25 '12 at 6:27
  • 1
    Ctrl-U and Ctrl-D only scroll a partial screen. You can use Ctrl-B and Ctrl-F for full screens. – echristopherson Dec 8 '12 at 20:30

I preferred the answer from superuser:

Add the following to your ~/.screenrc:

termcapinfo xterm ti@:te@
termcapinfo xterm-color ti@:te@

Scrolling back feels a bit weird because it seems to scroll all windows at once and screen disappears completely if you go back too far but for me that was far the best solution because I don't need to instruct the user to use another shortcut than the well-known Shift+PgUp / Shift+PgDown.

Update: It seems that this solution skips some parts of the output when scrolling. So I cannot recommend it anymore. But I leave the answer here for completeness.

  • 1
    Or: termcapinfo xterm* ti@:te@ for both. – kenorb Jan 17 '16 at 12:30

check your personal or system-wide screenrc files, search things like eval "copy". If it exists, try to comment it out and see if it helps or not.

As far as I know, Page Up is not bind to start copy mode by default in screen. I suspect that this behavior is due to some settings specific in your remote system. I personally bind F9 and F10 to scroll up and down in the copy mode and left other keys to programs running in screen:

bindkey -k k9 eval "copy" "stuff ^u"
bindkey -k k; eval "copy" "stuff ^d"
bindkey -m -k k9 stuff ^u
bindkey -m -k k; stuff ^d
  • 2
    ^u and ^d only scroll a partial screen. You can use ^b and ^f for full screens. – echristopherson Dec 8 '12 at 20:28

Put this in your .screenrc:

bindkey "^[[5~" eval "copy" "stuff ^b"
bindkey "^[[6~" eval "copy" "stuff ^f"

This will make PgUp and PgDn enter copy mode and move by pages within screen's scrollback buffer.

Caveat: You still need to hit Esc to exit screen's copy mode.

Your Answer

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