我正在运行iterm2,当我在tmux模式下,我在vim中设置的配色方案不显示。只有我设定的配色方案。如果我从shell运行vim,配色方案显示正确-只有当我在tmux模式。
我尝试过在vim中设置:colorscheme molokai(见下面的截图),它没有改变-再次,iterm2的默认配色方案保持不变。
我是否遗漏了对iterm或tmux.conf的一些设置?我的图都在github上。
我正在运行iterm2,当我在tmux模式下,我在vim中设置的配色方案不显示。只有我设定的配色方案。如果我从shell运行vim,配色方案显示正确-只有当我在tmux模式。
我尝试过在vim中设置:colorscheme molokai(见下面的截图),它没有改变-再次,iterm2的默认配色方案保持不变。
我是否遗漏了对iterm或tmux.conf的一些设置?我的图都在github上。
当前回答
如果你使用tmuxinator或mux,你需要在.bashrc或.zshrc中添加这些:
alias tmux='TERM=screen-256color tmux -2'
alias tmuxinator='TERM=screen-256color tmuxinator'
alias mux='TERM=screen-256color mux'
这些力用256色在终端上。
然后tmux, tmuxinator和mux命令都将工作。
其他回答
从tmux手册页,添加标志如下:
tmux -2
这个-2标志强制tmux以256色模式运行。
这对我很有用
I just discovered why I was having a lot of confusion. I, like others here, was having a difficult time getting the default-terminal setting to take effect. I remembered that I had a tmux session in the background. I re-attached my session, closed out my processes, and closed ALL tmux processes. The next time I restarted tmux the default-terminal setting in .tmux.conf began to take effect. I don't know if others are doing this as well but I recommend closing all tmux processes before modifying the .tmux.conf file.
我让我的设置在我的本地机器上工作(OSX 10.9.5 with iTerm2),没有对.bashrc或.bash_profile进行任何修改。我所做的只是将行set -g default-terminal "xterm-256color"添加到~/.tmux.conf并重新启动所有tmux进程。
我让我的远程设置(ssh到Ubuntu 14.04)以完全相同的方式工作,而不需要对.bashrc进行任何修改。我只是在远程机器上的~/.tmux.conf中添加了set -g default-terminal "xterm-256color",并重新启动了所有远程tmux进程。
你可以在tmux会话中通过echo $TERM来测试Vim所看到的内容。它一直将screen作为值,直到我重新启动所有tmux进程,此时它如预期的那样反射xterm-256color。
希望这能有所帮助。
我使用gnome终端,这解决了问题,但(0)不要忘记:
killall tmux
(1)编辑.tmux.conf
# 24 bit color
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"
(2)编辑:.vimrc
" Enable true color
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
rinetd发布的关于tmux回购问题的解决方案: https://github.com/tmux/tmux/issues/1246
因为这是谷歌上的第一个结果,因为上面没有一个有用..我想张贴这个,以便有人可能会发现它有帮助
在. vimrc:
set background=dark
set t_Co=256
HTH
我已经尝试了上面所有的指令,我发现最重要的事情是我必须显式地在我的.bashrc文件中添加以下一行。
export TERM=screen-256color
我不知道为什么别名tmux="TERM=screen-256color-bce tmux"不工作。 我使用的是Sierra 10.12.1。