【问题标题】:.tmux.conf: update status commands on panel focus.tmux.conf:更新面板焦点上的状态命令
【发布时间】:2012-10-16 19:12:31
【问题描述】:

我的 .tmux.conf 中有一行简单地显示了我所在的 git 分支。

set -g status-right ' #[bg=colour33] Branch #[(git branch)] '

在 tmux 中工作时,我经常在不同的目录中使用面板。所以我的问题变成了,有没有办法让状态命令根据我的“面板的 cwd”重新执行,而不是它现在正在做的事情,它似乎只保留了我第一次打开 tmux 时所在的目录.. ?

【问题讨论】:

    标签: git bash shell tmux


    【解决方案1】:

    在较新版本的 tmux 中,您可以使用 pane_current_path 来实现:

    set -g status-right '#(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD)'
    

    【讨论】:

      【解决方案2】:

      查看这个答案 - Pane Title in Tmux - 您可能需要覆盖 chpwd 函数,每当您在 bash/zsh 中更改工作目录时都会调用该函数。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-12-11
        • 1970-01-01
        • 1970-01-01
        • 2021-10-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-05-05
        相关资源
        最近更新 更多