【问题标题】:Vim displaying incorrect colors inside tmuxVim 在 tmux 中显示不正确的颜色
【发布时间】:2017-08-12 14:42:41
【问题描述】:

我有 Ubuntu 17.04、Tmux: 2.3、vim:8.0 和一个名为 onedark 的配色方案

当我不在在 TMUX 中时,Vim 显示正确的颜色方案,但是当我 TMUX 中时,vim 看起来完全不同。

我厌倦了 .bashrc、.vimrc 和 .tmux.conf 中所有可能的配置,但没有运气。 我最近才发现,当我在 Tmux 中使用 sudo、root(管理)权限运行 vim 时,一切都按预期工作,我认为这不是一个好的解决方案。

所以我的问题是如何让 vim 显示一致的配色方案,而不管我在 Tmux 内部还是外部的 root 权限或天气。

我与颜色相关的配置是。

.tmux.conf

set-option -sa terminal-overrides ",xterm*:Tc"
set -g default-terminal "xterm-256color"

.vimrc

set encoding=utf-8
set nocompatible 
set t_Co=256
set t_ut=
set background=dark
set showmatch
syntax on

if (empty($TMUX))

  if (has("nvim"))
    let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  endif

  if (has("termguicolors"))
    set termguicolors
  endif

endif

colorscheme one

如果在 tmux 内部或外部执行 echo $TERM,我会得到 xterm-256color

【问题讨论】:

  • 也许罪魁祸首是您在终端中启用的termguicolors 设置而不是 Tmux?
  • 比 @AlexanderBatischev 我能够将 termguicolors 从 IF 条件中移出,现在一切正常。
  • 很高兴听到这个消息!我现在发表了我的评论作为答案;请接受。
  • @AlexanderBatischev 绝对

标签: vim tmux vim-syntax-highlighting


【解决方案1】:

罪魁祸首是您在终端中启用的termguicolors 设置,而不是 Tmux。将其移出最外层的if 应该可以解决问题。

【讨论】:

    猜你喜欢
    • 2014-12-03
    • 1970-01-01
    • 1970-01-01
    • 2019-08-22
    • 2023-01-13
    • 2016-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多