On Mon, 30 Sep 2013, ping song wrote:

Jostein's method is clear but that is no what I wanted, I just need
a c-a c-a equivalent , but switching between the last 2 windows
instead of 1.

Wes's solution looks more subtle ,

lol, subtle="less clear".  ;)

i will try to be more clear.

<ctrl>-a <ctrl>-a (a.k.a. screen's 'other' command) cycles through a
sequence of two windows: the current window, and the one previously
displayed.

and, if i understand correctly, what you would like is a command that
cycles through a sequence of three windows: (a) the current window,
(b) the window previously displayed, and (c) the most recently
displayed window distinct from both (a) and (b).

in a session with just three windows, this is easy: 'prev' and 'next'.
but otherwise, i don't know how to do this.

so i suggested a workaround that might suffice, but only in case you
know in advance which three programs you will want to cycle through.
(like, for example, if you frequently use three particular programs
together, to accomplish some common task, and don't want to think too
hard about how to bounce among them.)

the workaround is to nest, inside of your main screen session, a new
session running only the three programs you would like to cycle
through.

(of course, the method is not limited to just three programs, as long
as you don't mind a cycle larger than three.)

but I don't get the exact config to make it happen...can you paste
the config for me to test?

well, for the basic setup, there's hardly anything to paste.

let's say you know in advance which three programs you would like to
cycle through.

first you might create an alternative config file to spawn some
windows running just the three programs you have in mind.  for
example, in a config file ~/.screenrc_triad, you might have something
like this:

  screen program1
  screen program2
  screen program3

then, from your main screen session, hitting <ctrl>-a followed by

 :screen -t triad screen -mc ~/.screenrc_triad

spawns a window named 'triad' in your main session.  in that new
window runs the subordinate screen session.

then, in the triad window, with default keybindings, you can cycle
through the windows running programs 1 through 3:

 <ctrl>-a a <space>

cycles forward, and

 <ctrl>-a a <backspace>

cycles backward.

if you don't like the default keybindings, there are a number of ways
to simplify them.  look for these commands in screen's documentation:
'escape', 'bind', and 'keybind'.

hope this helps.

-wes

_______________________________________________
screen-users mailing list
screen-users@gnu.org
https://lists.gnu.org/mailman/listinfo/screen-users

Reply via email to