Split Tmux 窗口模拟 vim 的 nosplitbelow 和 nosplitright 行为

Split Tmux 窗口模拟 vim 的 nosplitbelow 和 nosplitright 行为

Tmux 具有正常的键绑定来水平和垂直分割终端。但它会在当前活动窗格的右侧和下方分开。有没有办法分割当前活动窗格,以便新窗格在当前活动窗格的左侧和上方生成?

答案1

man tmux

     split-window [-bdfhvP] [-c start-directory] [-l size | -p percentage] [-t target-pane]
             [shell-command] [-F format]
                   (alias: splitw)
             Create a new pane by splitting target-pane: -h does a horizontal split and -v a
             vertical split; if neither is specified, -v is assumed.  The -l and -p options
             specify the size of the new pane in lines (for vertical split) or in cells (for
             horizontal split), or as a percentage, respectively.  The -b option causes the
             new pane to be created to the left of or above target-pane.  The -f option cre‐
             ates a new pane spanning the full window height (with -h) or full window width
             (with -v), instead of splitting the active pane.  All other options have the
             same meaning as for the new-window command.

因此,放入以下几行~/.tmux.conf并获取它会产生所需的行为。注意该-b选项。

# pane splitting
bind -r v split-window -bh
bind -r b split-window -bv

相关内容