Re: configuring keys for copy mode scrolling

Phil! Gold <[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <[email protected]>
* Christoph Anton Mitterer <[email protected]> [2012-07-10 21:08 +0200]:
> Is there an overall working way to making scrolling up/down working via
> the Shift+PgUp/PgDown, familiar to most users.

Not really, unfortunately.  The basic problem is twofold: first, terminal
emulators typically handle those keystrokes themselves; if you want screen
to see them (so you can go into screen's scrollback buffers), you'll have
to disable the terminal's handling of them, which will be different for
every terminal.  Second, there's no termcap definition for those keys, so
there's no generic way to tell screen "handle a Shift+PgUp keypress"; you
have to specify the characters the terminal sends, which will vary from
one to the next.

In case you use xterm, here's my xterm-specific config:

My .Xresources file contains:

    ! I use screen a lot, so its scrollback buffer is often more accurate than
    ! xterm's.  Thus, I pass through Shift-PgUp and Shift-PgDn to allow screen to
    ! use them.  I've hardcoded the escape sequences (rather than using insert())
    ! because I had to hardcode the sequences in my .screenrc (because there are no
    ! termcap codes for shifted PgUp and PgDn).
    XTerm.vt100.translations: #override \n\
        Shift <Key>Prior:string(0x1b) string("[5;2~") \n\
        Shift <Key>Next:string(0x1b) string("[6;2~")

and my .screenrc contains:

    # Make shift-PgUp and shift-PgDn work like they do in xterm.  (Note that this
    # requires xterm to be configured to pass those keys through, and not try to
    # act on them itself.)
    bindkey "^[[5;2~" eval "copy" "stuff ^u"
    bindkey -m "^[[5;2~" stuff ^u
    bindkey -m "^[[6;2~" stuff ^d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.