在 tmux 中使用 vim 时,我可以看到启用了 256 色支持。使用 $tput 颜色
但是,在 tmux 中更改 vim 中的颜色方案将在每行的基础上更改颜色方案,而不是整个背景。看截图
例如,这是我的 .vimrc 文件的片段。我原来的颜色方案是日光化的,然后在运行 :colorscheme molokai 后你会看到会发生什么。
信息
在我的 ~/.tmux.conf
set -g default-terminal "screen-256color"
Run Code Online (Sandbox Code Playgroud)
在我的 ~/.vimrc
set t_Co=256
Run Code Online (Sandbox Code Playgroud)
在我的 ~/.bashrc 中
# ryan
export TERM="xterm-256color"
# ryan
alias tmux="tmux -2"
Run Code Online (Sandbox Code Playgroud)
在我的 ~/.profile 中
# ryan 256 color support
if [ -e /usr/share/terminfo/x/xterm-256color ]; then
export TERM='xterm-256color'
else
export TERM='xterm-color'
fi
Run Code Online (Sandbox Code Playgroud)
任何想法如何在 vim 中获得完整的配色方案?我所有的文件片段看起来都不错吗?
blo*_*loy 78
从 .bashrc 和 .profile 的外观来看,tmux 中的 shell 覆盖了 tmux conf 中的“默认终端”设置。像这样的东西:
TERM=screen-256colorTERM=xterm-256color你可以通过运行来检查这个
echo $TERM
Run Code Online (Sandbox Code Playgroud)
在一个新的 tmux 外壳中。
Tmux 对正确设置终端比较挑剔。如果可以,请在 gnome-terminal 的配置中设置 term 值,而不是在您的 .bashrc 中。如果失败,请通过检查“screen”或“screen-256color”术语来包围这些设置,并且在这种情况下不要重置它们。
Tmux 真的希望终端设置为screen或screen-256color
小智 5
这就是在 #Ubuntu 和 #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 problem
Run Code Online (Sandbox Code Playgroud)
重新加载设置:
$ source ~/.bashrc # Ubuntu
$ source ~/.bash_profile # Mac
为 Mac 设置 .bashrc(因为它被 tmux 使用)
# File: ~/.bashrc (Mac)
source ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)
在 ~/.tmux.conf 中设置“default-terminal”选项。
# File: ~/.tmux.conf
set -g default-terminal "screen-256color" # Mac and Ubuntu
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
70402 次 |
| 最近记录: |