When I use tabs in vim, I use the shortcut ctrl+pgup and ctrl+pgdn for navigating between tabs. I realize I can do :tabnext and :tabprev, but that is certainly more keystrokes.

Everything works fine until I'm running vim in a screen session. To reproduce:

touch .screenrc.tmp && screen -c .screenrc.tmp 

(launch screen with an empty screenrc)

then run:

vim -p file1 file2 

and attempt to navigate between tabs via ctrl+pgup and ctrl+pgdn. Some strange capitalization changes will happen too, if you have some text in either file.

screen version is 4.00.03jw4

vim version is 7.3.429


  • 2
    The normal way to do this is gt and gT. Move forward or backwards a tab. Most likely pageup and pagedown are being interpreted differently in screen. – FDinoff Jul 23 '13 at 0:27

Compare the t_kP option in each scenario. Vim in Xterm is ^[[5;*~; Vim in Screen is ^[[5~. When the latter value is used for that option, the escape sequence ^[[5;5~ isn't recognized as being ctrl-pageup. I always use xterm, so this plugin will set t_kP and other Vim terminal options so modified F keys, page up/down, etc. just work: https://github.com/godlygeek/vim-files/blob/master/plugin/terminalkeys.vim

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.