【发布时间】:2021-07-07 06:54:57
【问题描述】:
是否有任何选项可以控制 Tmux 中活动或非活动窗格的背景颜色?
【问题讨论】:
标签: tmux
是否有任何选项可以控制 Tmux 中活动或非活动窗格的背景颜色?
【问题讨论】:
标签: tmux
似乎tmux-2.1(2015 年 10 月 18 日发布)现在允许指定各个窗格的颜色。来自changelog:
* 'select-pane' now understands '-P' to set window/pane background colours.
例如[来自手册] 将窗格 1 的前景(文本)更改为蓝色,将背景更改为红色:
select-pane -t:.1 -P 'fg=blue,bg=red'
为了回答最初的问题,我在~/.tmux.conf 中使用以下几行来设置背景/前景颜色以模仿iTerm 中的行为:
#set inactive/active window styles
set -g window-style 'fg=colour247,bg=colour236'
set -g window-active-style 'fg=colour250,bg=black'
# set the pane border colors
set -g pane-border-style 'fg=colour235,bg=colour238'
set -g pane-active-border-style 'fg=colour51,bg=colour236'
我之前没有见过window-style 和window-active-style 命令,但也许它们在以前的 tmux 版本中可用。
此外,这两行对于轻松拆分窗格非常有用:
bind | split-window -h
bind - split-window -v
编辑:正如 Jamie Schembri 在 cmets 中提到的,tmux 2.1 版(至少)现在将安装:
brew install tmux
编辑(2017 年 10 月):brew 现在安装 tmux 2.6,以上仍然有效。
编辑 Vim 窗格:如果您发现“非活动着色”不适用于 Vim 窗格,可能是由于您使用的配色方案。尝试使用pablo 方案;即在 Vim 窗格中:
:colo pablo
要使其与您自己的自定义 Vim 颜色方案一起使用,请确保 Normal 突出显示的设置没有指定 ctermbg 或 guibg。例如,“非活动着色”不适用于 murphy colourscheme,因为在 murphy.vim 中有一行:
hi Normal ctermbg=Black ctermfg=lightgreen guibg=Black guifg=lightgreen
将ctermbg 或guibg 设置为Black。但是,将此行更改为:
hi Normal ctermfg=lightgreen guifg=lightgreen
将使“非活动着色”工作。
EDIT 2019 年 7 月 Augusto 提供了一个很好的建议,也可以更改行号的背景颜色。我在 vim 配色方案中使用的是以下内容:
hi Normal guifg=#e6e1de ctermfg=none gui=none
hi LineNr guifg=#e6e1de ctermfg=none gui=none
【讨论】:
brew 现在安装 2.1。旁注:这适用于vim-diminactive。
select-pane ... 可以更改窗格颜色,但window-style 和window-active-style 似乎没有任何效果。在iTerm 中运行tmux 2.6。有什么想法吗?
.tmux.conf 的顶部,现在它可以工作了! (花了太长时间,我无法编辑评论;我认为值得留给后代)
没有选项可以更改窗格的背景颜色,但可以选择设置窗格边框颜色(样式)
pane-active-border-style style
Set the pane border style for the currently active
pane. For how to specify style, see the message-command-style option.
Attributes are ignored.
pane-border-style style
Set the pane border style for paneas aside from the
active pane. For how to specify style, see the message-command-style option.
Attributes are
ignored.
【讨论】:
# highlight focused pane (tmux >= 2.1), possible values are:
# - true
# - false (default)
tmux_conf_theme_highlight_focused_pane=true
# focused pane colours:
#tmux_conf_theme_focused_pane_fg='default'
tmux_conf_theme_focused_pane_bg='#191919'
【讨论】: