27

I've started splitting window in GNU screen into different regions - rather than switching between windows.

Anyway, having split a window into 4 regions (2x2) it takes 3 C-a <Tab> to return focus to the original region. That is quite cumbersome...

Are there other keybindings to move up, down, left, right between regions?

I can't understand this: hitting C-a t gives me time, does not switch to top win.

Should I change keybindings?

neurino
  • 1,819
  • 3
  • 19
  • 25
  • 2
    Adding as a comment since it's not an answer but see if tmux is available for your distribution. It's a modern re-write of what screen is. Very nifty and cleanly supports exactly what you're asking for. http://tmux.sourceforge.net/ – Kyle Smith Jun 01 '11 at 13:12
  • @Kyle: thanks, I know of tmux and probably I'll check it out. Moreover I notice screen splits are lost if you detach and reattach or just lock. A the end swapping between full-screen windows using C-a C-a or C-a windownumber is way more comfortable... – neurino Jun 01 '11 at 13:17

2 Answers2

15

screen commands for switching between regions are: actually focus up, focus down, focus right and focus left. To type these commands (or any other screen command, for that matter) you type C-a :focus up, for example.

These commands are tedious to type, that's why you must create key bindings in your ~/.screenrc file. Since I'm a Vim user I opted for these lines in my ~/.screenrc file:

bind j focus down
bind k focus up
bind l focus right
bind h focus left

To switch to the left region I type C-a h

sherzodr
  • 151
6

Take a look at the manual (man screen) - search for focus (using / to search). There is an example for binding focus up/down/top/bottom keys there. Not sure about left/right - focus doesn't seem to accept those as parameters.

Danny Staple
  • 2,161
  • 1
  • 15
  • 22
  • you are right about left and right, it was top and bottom, my fault. The link in my answer is same as man screen anyway. It would be useful to me having a C-a Shift <Tab> to go backwards in order... – neurino Jun 01 '11 at 11:14
  • 2
    if I only knew what to put in bind command for Shift and Tab... – neurino Jun 01 '11 at 11:27
  • Yes - that would make a load of sense - you could probably bind it to focus up. You may need to figure out a termcap name for shift + tab though. A quick google shows that may take a bit of fiddling. – Danny Staple Jun 01 '11 at 11:28
  • Okay - names I've found (none which yet work with/without -k) backtab, shifted-tab, F91, kB. – Danny Staple Jun 01 '11 at 11:37
  • 1
    This looks useful - http://www.staldal.nu/tech/2009/01/10/how-to-use-ctrl-tab-in-gnu-screen/ – Danny Staple Jun 01 '11 at 11:39
  • @Danny: thanks for searching, the link as far as I understand uses Xresources but on my ubuntu server I have no X... is it possible anyway? In the past I used xev to get key codes form wm keybindings, nothing that works without X. I read about using cat to show sequence (^[[Z) but can't find a way to fit it into screen bind – neurino Jun 01 '11 at 11:54
  • Interesting - that sequence defaults to copy - ^[. How are you interacting with the box - local vt or via remote shell session? – Danny Staple Jun 01 '11 at 11:58
  • @Danny: via remote shell (ssh) – neurino Jun 01 '11 at 12:10
  • using xev I get keysym 0xfe20 (octal 177040) for Shift Tab (ISO_Left_Tab) but screen bind does not accept \0177040 as octal, too long as it complains waiting for something like \032... – neurino Jun 01 '11 at 12:25