日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

tmux 如何自定义背景颜色 | How does the tmux color palette work?

發布時間:2024/2/28 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 tmux 如何自定义背景颜色 | How does the tmux color palette work? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

坑1:256 color support for vim background in tmux

解決終端顏色配置與 tmux 顏色配置不匹配問題。

https://superuser.com/questions/399296/256-color-support-for-vim-background-in-tmux

原因

From the look of your .bashrc and .profile, the shells inside tmux are overriding the ‘default-terminal’ setting in your tmux conf. Something like this:

  • tmux creates new shell with TERM=screen-256color
  • .bashrc/.profile run, set TERM=xterm-256color
  • vim runs, tries to use incorrect TERM for tmux

you can check this by running

echo $TERM

in a fresh tmux shell.

Tmux is relatively picky about having a terminal set correctly. If you can, set the term value in gnome-terminal’s configuration, not in your .bashrc. Failing that, surround those settings with a check for “screen” or “screen-256color” TERM, and don’t reset them in that case.

Tmux REALLY wants the terminal set to screen or screen-256color

解決方法

This is what worked for me in #Ubuntu and #Mac:

# File: ~/.bashrc (Ubuntu), ~/.bash_profile (Mac) # for VIM and TMUC if [ "$TERM" = "xterm" ]; thenexport TERM=xterm-256color fi alias tmux='tmux -2' # for 256color alias tmux='tmux -u' # to get rid of unicode rendering problem

Reload settings:

$ source ~/.bashrc # Ubuntu

$ source ~/.bash_profile # Mac

Set up .bashrc for Mac (as it is used by tmux)

# File: ~/.bashrc (Mac) source ~/.bash_profile

Set up “default-terminal” option in ~/.tmux.conf.

# File: ~/.tmux.conf set -g default-terminal "screen-256color" # Mac and Ubuntu

坑 2:Change background color of active or inactive pane in Tmux

詳解 .tmux.conf 配置文件設置背景顏色的方法。其中,fg 是字體顏色,bg 是背景顏色。

https://newbedev.com/change-background-color-of-active-or-inactive-pane-in-tmux

It seems that tmux-2.1 (released 18 October 2015) now allows the colours of individual panes to be specified. From the changelog:

* 'select-pane' now understands '-P' to set window/pane background colours.

e.g. [from the manual] to change pane 1’s foreground (text) to blue and background to red use:

select-pane -t:.1 -P 'fg=blue,bg=red'

To mimic iTerm colour scheme:

To answer the original question, I use the following lines in my ~/.tmux.conf for setting the background/foreground colours to mimic the behaviour in 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'

坑 3:Reloading tmux config

寫完配置文件后,需要手動 source 使其生效。

https://blog.sanctum.geek.nz/reloading-tmux-config/,Posted on 2012-03-19

If you have made changes to your tmux configuration file in the ~/.tmux.conf file, it shouldn’t be necessary to start the server up again from scratch with kill-server. Instead, you can prompt the current tmux session to reload the configuration with the source-file command.

This can be done either from within tmux, by pressing Ctrl+B and then : to bring up a command prompt, and typing:

:source-file ~/.tmux.conf

Or simply from a shell:

$ tmux source-file ~/.tmux.conf

This should apply your changes to the running tmux server without affecting the sessions or windows within them.

This entry was posted in Tmux and tagged configuration, reload, source, source-file, tmux.conf by Tom Ryder. Bookmark the permalink.


附:tmux 配置中的 colour0~255 顏色表

You can create it with for i in {0..255}; do printf "\x1b[38;5;${i}mcolor%-5i\x1b[0m" $i ; if ! (( ($i + 1 ) % 8 )); then echo ; fi ; done

配置文件:

效果:

總結

以上是生活随笔為你收集整理的tmux 如何自定义背景颜色 | How does the tmux color palette work?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。