使用 tmux + st

st 是一个非常的简单的终端软件，它对我的来说只少一个功能，就是多路服用 (上下左右切分窗口), 这在其他终端软件中都有提供，比如说 wezterm.

而 tmux 刚好可以提供这个功能:

Copy
tmux split-window # 向下切分
tmux split-window -h # 向右切分

然后就可以在 st 中设置快捷键:
{{< block type="details" >}}

Copy
/* 切分 */
static char *sp[] = { "/bin/sh", "-c", "tmux split-window","externalpipe", NULL };
static char *sph[] = { "/bin/sh", "-c", "tmux split-window -h","externalpipe", NULL };

/* 切换窗口 */
static char *gd[] = { "/bin/sh", "-c", "tmux select-pane -D","externalpipe", NULL };
static char *gu[] = { "/bin/sh", "-c", "tmux select-pane -U","externalpipe", NULL };
static char *gr[] = { "/bin/sh", "-c", "tmux select-pane -R","externalpipe", NULL };
static char *gl[] = { "/bin/sh", "-c", "tmux select-pane -L","externalpipe", NULL };

/* 调整窗口大小 */
static char *rd[] = { "/bin/sh", "-c", "tmux resize-pane -D 2","externalpipe", NULL };
static char *ru[] = { "/bin/sh", "-c", "tmux resize-pane -U 2","externalpipe", NULL };
static char *rr[] = { "/bin/sh", "-c", "tmux resize-pane -R 2","externalpipe", NULL };
static char *rl[] = { "/bin/sh", "-c", "tmux resize-pane -L 2","externalpipe", NULL };

static Shortcut shortcuts[] = {
{ ControlMask, XK_minus, externalpipe, {.v = sp } },
{ ControlMask, XK_backslash, externalpipe, {.v = sph } },

{ MODKEY, XK_Up, externalpipe, {.v = gu} },
{ MODKEY, XK_Down, externalpipe, {.v = gd} },
{ MODKEY, XK_Left, externalpipe, {.v = gl} },
{ MODKEY, XK_Right, externalpipe, {.v = gr} },

{ ControlMask, XK_Up, externalpipe, {.v = ru} },
{ ControlMask, XK_Down, externalpipe, {.v = rd} },
{ ControlMask, XK_Left, externalpipe, {.v = rl} },
{ ControlMask, XK_Right, externalpipe, {.v = rr} },
};

{{< /block >}}

最后关闭 tmux 的 status line, 因为我只需要它的 pane 功能，其他的都太碍眼了.

Copy
set -g status off

我的分支: https://github.com/fzdwx/st