如何创建终端或工作区的层次结构?

如何创建终端或工作区的层次结构?

我想知道是否有某种方法可以在 Linux 上的屏幕会话中创建终端层次结构/树?

我不介意对此进行破解,所以如果有一个项目正在进行中,我愿意参与其中。


解释:

我想要一些类似的东西

1 bash
  1.1 bash
  1.2 bash 2 bash 3 bash
  3.1 bash
    3.1.1 bash
    3.1.2 bash

如果可以给终端贴上标签,而不是通过某种我怀疑不存在的安排来导航,那就太好了。这样你就可以使用例如^A:goto happydays或跳转到一个终端^A:goto dykstra.angry

每个浏览器都提供了创建一组包含相同性质文档的平面选项卡的功能。GNUscreen无需使用选项卡即可实现相同的功能。Linux 和 OS/X 窗口管理器提供了将窗口组织到工作区数组中的能力,这又是同样的操作。

我希望不仅能够将事物分组为树结构,还能够从结构的一部分到另一部分创建引用(又名符号链接,又名指针),以及从给定节点向下递归应用属性(例如默认目录,配色方案...)。

答案1

你知道,这听起来很像屏风可以做

答案2

刚刚发现这个问题。

您可以在 gnu-screen 中执行我认为您正在寻找的操作。在 .screenrc 中,添加:

screen -t 1.1 0 # just a shell

screen -t 1.2 1 screen -m -e^xx-c ${HOME}/.screenrc-1.2 #new session inside accessed by Ctrl-x

screen -t 1.3 2 screen -m -e '^xx' -c ${HOME}/.screenrc-1.3 #yet another new session

然后 ~/.screenrc-1.2 和 ~/.screenrc-1.3 可以为子会话单独设置;例如,.screenrc-1.3 可以定义更多子会话。一旦进入整个会话,您就可以在它们之间切换,并且内部会话有自己的控制序列(ctrl-x),您可以按名称或数字导航到:select 1.2

答案3

嵌套屏幕会话(如 Archege 所建议的)将实现您想要做的事情,但管理多层嵌套(尤其是在向正确的屏幕会话发送命令时)可能会很麻烦。较新版本的屏幕(我使用的是 4.1.0)支持窗口组,它可以完成您想要完成的大部分任务。窗口组似乎无法执行任何类似于硬链接的功能,并且该功能只有最低限度的集成和文档(大概是因为相对较新且相对晦涩)。但是,窗口组的一个显着优势是它们通过单个屏幕会话工作;因此,管理嵌套排列不那么麻烦。

下面的代码块是我的 .screenrc 中与窗口组相关的部分的带注释的复制/粘贴:

# first, make a root group that all of the other groups will go into
# note that the "//group" is *NOT* a comment; without it, only a
#  standard window will be spawned
screen -t root    0 //group

# select the root window to make sure that the next created group will
#  end up there, and make another group nested inside of it
select 0
screen -t shells  1 //group

# rinse and repeat for more groups
select 0
screen -t editors 2 //group
select 0
screen -t SSH     3 //group
select 0
screen -t scratch 4 //group
select 0
screen -t scripts 5 //group

# to add windows into first group, select it and then create windows
#  as normal
select 1
screen 6
screen 7

# rinse and repeat as desired for the other groups
select 2
screen 8
# and so on...

相关内容