English 中文(简体)
How can you tell which pane in Tmux is focused?
原标题:
  • 时间:2011-02-03 17:52:31
  •  标签:
  • 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?

最佳回答

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.

问题回答

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.

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

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  

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.

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




相关问题
How can you tell which pane in Tmux is focused?

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

Why does tmux erase terminal contents on editor exit?

Say I m running tmux and use "ls" to get something on the screen. Then I enter Vim to edit some file. After exiting Vim, tmux erases whatever text is above the bash prompt (not like the clear command ...

tmux up-pane/down-pane missing

I d like to rebind the action of changing the active pane in tmux. In version 1.1, I did it like this: bind-key -n C-] up-pane bind-key -n C-[ down-pane I ve upgraded to to version 1.3 recently, ...

ux客户之间的窗口

我只是学习的 t,我没有屏幕经验。 我不禁要问,我是否能够把一个ux客的窗口转移到另一个ux客户。 我想把我的国际审查委员会的客户转移到我的屏幕上的新窗口。

How to share clipboard between tmux/vim and osx

I found solution for iterm+vim here -> Vim: copy selection to OS X clipboard Now i use fakeclip, and it work in vim directly, but not when i use tmux to split terminal window.

热门标签