当前位置:网站首页>tmux 如何自定义背景颜色 | How does the tmux color palette work?
tmux 如何自定义背景颜色 | How does the tmux color palette work?
2022-06-24 21:54:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
坑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 $TERMin 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" ]; then
export TERM=xterm-256color
fi
alias tmux='tmux -2' # for 256color
alias tmux='tmux -u' # to get rid of unicode rendering problemReload settings:
$ source ~/.bashrc # Ubuntu $ source ~/.bash_profile # Mac
Set up .bashrc for Mac (as it is used by tmux)
# File: ~/.bashrc (Mac)
source ~/.bash_profileSet 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.confOr simply from a shell:
$ tmux source-file ~/.tmux.confThis 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;
配置文件:
效果:
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/151786.html原文链接:https://javaforall.cn
边栏推荐
- Chinese and English instructions of trypsin
- 论文翻译 | RandLA-Net: Efficient Semantic Segmentation of Large-Scale Point Clouds
- 1. package your own scaffold 2 Create code module
- sql 聚合函数有哪些
- Smartctl 打开设备遇到 Permission denied 问题排查过程记录
- String common methods
- mpls 笔记 part 1
- JVM directive
- uni-app集成极光推送插件后真机调试提示“当前运行的基座不包含原生插件[JG-JPush]...”问题的解决办法
- IPC机制
猜你喜欢

Abnova丨5-甲基胞嘧啶多克隆抗体中英文说明

Fake wireless speakers in stores? Sony responded: the product has reserved a wired connection interface, which can be used in complex scenarios

中文地址与英文地址

第04天-文件IO

入职一家新公司,如何快速熟悉代码?

"One good programmer is worth five ordinary programmers!"
![搜索二维矩阵[二分巧用 + 记录不同于插入二分的解法]](/img/c9/afc03afd477bbfdd3c0dc54bacfd2d.png)
搜索二维矩阵[二分巧用 + 记录不同于插入二分的解法]
![uni-app集成极光推送插件后真机调试提示“当前运行的基座不包含原生插件[JG-JPush]...”问题的解决办法](/img/8b/0e982711c225ec8b0a2b90819d8a11.png)
uni-app集成极光推送插件后真机调试提示“当前运行的基座不包含原生插件[JG-JPush]...”问题的解决办法

(CVPR 2020) Learning Object Bounding Boxes for 3D Instance Segmentation on Point Clouds

Bi SQL drop & alter
随机推荐
监听 Markdown 文件并热更新 Next.js 页面
Q1季度逆势增长的华为笔电,正引领PC进入“智慧办公”时代
TC对象结构和简称
菊花链(寒假每日一题 39)
Redis and jedis
Hands on data analysis data modeling and model evaluation
RedisTemplate操作Redis,这一篇文章就够了(一)[通俗易懂]
胰蛋白酶中英文说明书
为猪脸识别而进行自己数据集的构建、训练「建议收藏」
Application session coverage solutions with different ports on the same server
Chinese and English instructions of Papain
String common methods
How to prepare for the last day of tomorrow's exam? Complete compilation of the introduction to the second building test site
LogMiner 数据库日志挖掘
PHP 利用getid3 获取mp3、mp4、wav等媒体文件时长等数据
Pbcms adding cyclic digital labels
1. package your own scaffold 2 Create code module
Abnova丨CSV 磁珠中英文说明
安超云:“一云多芯”支持国家信创政务云落地
mpls 笔记 part 1