如何判断 Tmux 中的哪个窗格是焦点?

发布于 2024-10-16 06:47:39 字数 89 浏览 6 评论 0原文

我开始使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

云仙小弟 2024-10-23 06:47:39

以下是相关设置:

pane-active-border-style fg=colour,bg=colour
    Set the pane border colour for the currently active pane.

因此,尝试将类似的内容添加到您的 ~/.tmux.conf 中:

set-option -g pane-active-border-style fg=blue

这将在活动窗格周围设置蓝色边框。 pane-active-border-style bg=colour 选项也可用于更明显的解决方案。

Here are the relevant settings:

pane-active-border-style fg=colour,bg=colour
    Set the pane border colour for the currently active pane.

So, try adding something like this to your ~/.tmux.conf:

set-option -g pane-active-border-style fg=blue

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.

冬天旳寂寞 2024-10-23 06:47:39

正如另一篇文章 现在可以在 tmux 2.1 中设置各个窗格的颜色。可以

set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=colour250,bg=black'

~/.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:

set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=colour250,bg=black'

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.

执着的年纪 2024-10-23 06:47:39

自定义 status-left 并使用 #P 字符对,即窗格编号。您可能想要在状态栏中包含的不仅仅是窗格编号,但以下是您将添加到 ~/.tmux.conf 中仅用于窗格编号的行的示例:

set-option -g status-left '#P'

请参阅有关更多字符对的 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:

set-option -g status-left '#P'

See the tmux man page for more character pairs: http://manpages.ubuntu.com/manpages/precise/en/man1/tmux.1.html

嗼ふ静 2024-10-23 06:47:39

对我有用的一种解决方案是在窗格切换热键的末尾添加一个显示窗格。这将显示所有窗格编号,当前窗格采用不同的颜色。您还可以使用 + q 显示窗格编号。

我使用 alt+h/j/k/l 在窗格之间切换,并使用以下绑定。

bind -n M-j select-pane -D \; display-pane                                                                                                                                                                                                               
bind -n M-k select-pane -U \; display-pane                                                                                                                                                                                                               
bind -n M-h select-pane -L \; display-pane                                                                                                                                                                                                               
bind -n M-l select-pane -R \; display-pane  

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.

bind -n M-j select-pane -D \; display-pane                                                                                                                                                                                                               
bind -n M-k select-pane -U \; display-pane                                                                                                                                                                                                               
bind -n M-h select-pane -L \; display-pane                                                                                                                                                                                                               
bind -n M-l select-pane -R \; display-pane  
赤濁 2024-10-23 06:47:39

对于 tmux 3,我可以在 .tmux.conf 中设置以下内容以获得微妙的边框指示器:

set-option -g pane-active-border-style bg=yellow

For tmux 3 I was able to set the following in my .tmux.conf for a subtle border indicator:

set-option -g pane-active-border-style bg=yellow
戏剧牡丹亭 2024-10-23 06:47:39

我希望活动窗格的边框比其他窗格更亮,
所以我选择了这个(适用于 tmux 1.8 w/CentOS 7):

~/.tmux.conf 片段

# rgb hex codes from https://www.rapidtables.com/web/color/RGB_Color.html
set-option -g pane-active-border-fg '#33FF33' # brighter green
set-option -g pane-border-fg '#006600' # darker green

tmux 手册页说十六进制 RGB 颜色将被近似,我发现十六进制代码比记住“colour47”更容易理解(out of color0-255)是一种浅绿色(如如何tmux 调色板有用吗?)。

tmux 手册页摘录:

message-bg colour
    Set status line message background colour, ...etc...
    or a hexadecimal RGB string such as ‘#ffffff’, which chooses the closest
    match from the default 256-colour set.

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

# rgb hex codes from https://www.rapidtables.com/web/color/RGB_Color.html
set-option -g pane-active-border-fg '#33FF33' # brighter green
set-option -g pane-border-fg '#006600' # darker green

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:

message-bg colour
    Set status line message background colour, ...etc...
    or a hexadecimal RGB string such as ‘#ffffff’, which chooses the closest
    match from the default 256-colour set.
请叫√我孤独 2024-10-23 06:47:39

[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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文