如何判断 Tmux 中的哪个窗格是焦点?
我开始使用 tmux (我正在考虑从屏幕切换),但是当我将一个窗口拆分为多个窗格时,我很难判断哪个窗格是焦点。是否有配置自定义或可以更明确地突出显示焦点窗格的东西?
I'm starting to use tmux (I'm thinking of switching from screen), but I'm having a hard time telling which pane is focused when I split a window into multiple panes. Is there a config customization or something that can highlight the focused pane a little more explicitly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
以下是相关设置:
因此,尝试将类似的内容添加到您的
~/.tmux.conf
中:这将在活动窗格周围设置蓝色边框。
pane-active-border-style bg=colour
选项也可用于更明显的解决方案。Here are the relevant settings:
So, try adding something like this to your
~/.tmux.conf
:That will set a blue border around the active pane. The
pane-active-border-style bg=colour
option can be used for a more visible solution, as well.正如另一篇文章 现在可以在 tmux 2.1 中设置各个窗格的颜色。可以
在
~/.tmux.conf
文件中使用:来显示活动/非活动窗格之间的差异。使用 Vim 如果您发现它不适用于 Vim 窗格,则可能与您使用的颜色方案有关。首先,尝试另一种颜色方案,例如
pablo
。有关更多详细信息,请参阅其他帖子。As answered in another post it is now possible in tmux 2.1 to set the colours of individual panes. Ones can use:
in the
~/.tmux.conf
file to show a difference between the active/inactive panes.With Vim If you find it does not work with Vim panes, it might be down to the colourscheme you are using. First, try another colourscheme such as
pablo
. For further details, see the other post.自定义
status-left
并使用#P
字符对,即窗格编号。您可能想要在状态栏中包含的不仅仅是窗格编号,但以下是您将添加到~/.tmux.conf
中仅用于窗格编号的行的示例:请参阅有关更多字符对的 tmux 手册页: http://manpages .ubuntu.com/manpages/precise/en/man1/tmux.1.html
Customize
status-left
and use the#P
character pair, which is the pane number. You will probably want to include more than just the pane number in the status bar, but here is an example of the line you would add to your~/.tmux.conf
for just the pane number:See the tmux man page for more character pairs: http://manpages.ubuntu.com/manpages/precise/en/man1/tmux.1.html
对我有用的一种解决方案是在窗格切换热键的末尾添加一个显示窗格。这将显示所有窗格编号,当前窗格采用不同的颜色。您还可以使用
+ q
显示窗格编号。我使用
alt+h/j/k/l
在窗格之间切换,并使用以下绑定。One Solution that works for me is to add a display-pane at the end of the hotkey for a pane switch. This displays all the pane numbers, with the current pane in a different color. You can also use
<escape_key> + q
to display pane numbers.I use
alt+h/j/k/l
to switch between panes, and I use the following binding.对于 tmux 3,我可以在 .tmux.conf 中设置以下内容以获得微妙的边框指示器:
For tmux 3 I was able to set the following in my .tmux.conf for a subtle border indicator:
我希望活动窗格的边框比其他窗格更亮,
所以我选择了这个(适用于 tmux 1.8 w/CentOS 7):
~/.tmux.conf 片段
tmux 手册页说十六进制 RGB 颜色将被近似,我发现十六进制代码比记住“colour47”更容易理解(out of color0-255)是一种浅绿色(如如何tmux 调色板有用吗?)。
tmux 手册页摘录:
I wanted the active pane's borders to be brighter than other panes,
so I went with this (works in tmux 1.8 w/CentOS 7):
~/.tmux.conf fragment
The tmux man page says hex-RGB colors will be approximated, and I find the hex codes easier to understand than remembering "colour47" (out of colour0-255) is a kind of light green (as described in How does the tmux color palette work?).
tmux man-page excerpt:
[ctrl+b, z] 放大聚焦窗格,[ctrl+b, z] 缩小。这样您就会弄清楚哪个窗格是焦点。只是为了分享。
[ctrl+b, z] zooms in the focused pane, and [ctrl+b, z] zooms out. So you'll figure out which pane is focused. Just to share.