Tmux:如何配置tmux以显示状态栏上窗格的当前工作目录? [英] Tmux: How to configure tmux to display the current working directory of a pane on the status bar?
问题描述
我是新的tmux,我试图编辑我的tmux.conf文件,以使状态栏的左侧反映:
[SessionName] [CurrentPane] [CurrentWorkingDirectory]
我可以显示
SessionName
和 CurrentPane
。但是我不能显示 CurrentWorkingDirectory
。 我尝试了几个#(shell命令)
选项:
-
#(tmux select-pane -t:。#P; pwd)
:
打印一些其他$ PWD变量, NOT 反映当前窗格中bash会话的当前目录
。 -
#(tmux select-pane -t:。#P; tmux send-keys pwd Enter)
首先,虽然它打印了CurrentWorkingDirectory
如果我是
在终端。它打印在终端和 NOT 在状态
吧,像我想要的。其次,它每15
秒输入pwd Enter,无论我是否在一个终端,这是一个麻烦到
反向如果你不快速(像我一样)。
我试过这些选项,但没有效果,是否可以做我想要的?和如何?
有一个变量,似乎不在联机帮助页,开发版本。对我来说,它适用于1.8版本的tmux。
set -g status-left#{pane_current_path}
注意,当你把它放在窗口状态时,它也工作。每个窗口状态将提及相应的工作目录。
setw -g window-status-format#{pane_current_path}。
I am new to tmux and I am trying to edit my tmux.conf file to have the left side of the status bar reflect:
[SessionName] [CurrentPane] [CurrentWorkingDirectory]
I am able to display the SessionName
and CurrentPane
. However I can't get to display the CurrentWorkingDirectory
.
I've tried several #(shell command)
options:
#(tmux select-pane -t :.#P; pwd)
: But this prints some other $PWD variable which does NOT reflect the current directory of the bash session in the current pane.#(tmux select-pane -t :.#P; tmux send-keys pwd Enter)
Firstly, although it did print theCurrentWorkingDirectory
if I'm in a terminal. It prints this in the terminal and NOT in the status bar like how I want it. Secondly, It entered "pwd Enter" every 15 seconds whether or not I was in a terminal, which was a hassle to reverse if your not as quick (like I am).
I've tried these options but to no avail, is it possible to do what I want? and how?
There is a variable for that, which doesn't seem to be in the manpage but is mentioned in the development version. For me, it works in the 1.8 release of tmux.
set -g status-left "#{pane_current_path}"
Note that it also works when you put it in the window-status. Each window status will mention respective working directories.
setw -g window-status-format "#{pane_current_path}".
这篇关于Tmux:如何配置tmux以显示状态栏上窗格的当前工作目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!