Screen, Vim, Tabs, and C-PgUp/C-PgDn Mappings
I use screen with vim. One of the things I like about vim is that, much like unix itself, I’m always discovering useful new features, even after years of use.
Recently, I’ve been using tabs in vim to complement window regions. I’ve found it pretty useful, as there are times I’d want to keep certain tasks on one tab but not another. e.g. different source files open in windows on one tab; a test file + vim-pipe buffer showing the rest.
While I’m not using screen to change between multiple vim sessions in the same project anymore, I still use it pretty much everywhere: it’s there, and sometimes a wireless network isn’t. (Or you’re working one place and need to pack up and move to another place.) screen preserves your working sessions, so you don’t have to get everything “just right” again.
Unfortunately, screen seems to mangle the C-PgUp
and C-PgDn
commands vim
gives as default shortcuts to switch between tabs. Leaving out that these key
sequences are also used at the windowing level to switch tabs, it turns out
that screen was mangling them on the way through to vim, so vim didn’t see
C-PgUp
, for instance, it saw some other sequence.
Adding this to your .vimrc
will cause vim to recognize the sequence it sees
when running under screen: