Currently GNU screen will botch up certain keystrokes, for example CTRL pressed in combination with the arrow keys, so that eg when in vim insert mode, CTRL-PGUp will Uppercase the next/current word (or something like that). I'd like for it to work pretty much transparently, so that the functionality is the same as when it's not running (with the obvious exception of CTRL-a control sequences)... is this possible?
Also — and I suspect this is more or less a separate issue — I'd like for the scrollwheel to scroll back in the session log rather than cycling through the history as it does now. Doable? Or perhaps it could be set to emulate a much larger screen size that the terminal app that it's running under could keep that text in its session log. either way the goal would be to be able to use the mouse wheel and/or shift-up-arrow to scroll back in the session log.
You can change the default keystrokes in screen, but you will encounter the same kind of problems, just with other keystrokes. Byobu makes it easier to setup the basic keystrokes for screen. In byobu, the cycling back in session log with the mouse wheel is activated, too, so you could either use it or see how it's set in
/usr/share/byobu/profiles/common
.For scrollwheel, you want this in your
~/.screenrc
:For the cursor key stuff, this depends on how accurate your terminal emulation is, for the claimed terminal type in the window where you invoke screen, so it can do its mapping properly. Many terminal emulators claim, via
$TERM
, to be "xterm". But they're not and they don't emulate nearly enough of xterm to rightly claim that. Often, dropping down to claiming something likevt220
has been enough to improve things for me, but I don't recall the situation with screen -- I just use xterm itself. There are various torture tests you can run to see how bad your terminal emulator is at pretending to be xterm when it isn't.To fix things up after-the-fact, use the
bindkey
screen command. It's documented in screen(1), and if you use ^A: (or whatever you map screen's escape to, if not ^A (I use ^])) then you can type^A:bindkey -d
to see the current map.Not ideal, but you can put this in your
.vimrc
as an immediate fix:Sourced from this bug report.
Alternatively, you can tell
vim
to change its recognition of PgUp/PgDn:The former is nicer, in ways, because it means your PgUp/PgDn still work outside of
screen
.