Le jeu de couleurs vim se casse lors de l'utilisation de tmux

0

J'utilise Ubuntu 18 LTS, gnome-terminal, avec vim 8.0. Lorsque je n'utilise pas de jeu de couleurs, vim a le même aspect lorsqu'il est lancé à l'intérieur ou à l'extérieur de tmux: Vim_Comparison_Without_Color_Scheme

Cependant, lorsque j'utilise un jeu de couleurs (dans ce cas, gruvbox), vim sera étrange à l'intérieur de tmux: Vim_Comparison_With_Color_Scheme

Comment puis-je réparer cela?

Voici quelques informations de base:

Mon .vimrc:

" Don't try to be vi compatible
set nocompatible
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

"Colorscheme gruvbox https://github.com/morhetz/gruvbox
Plugin 'morhetz/gruvbox'

" Language support pack
Plugin 'sheerun/vim-polyglot'

call vundle#end()

" Indenting https://vi.stackexchange.com/questions/10124/what-is-the-difference-between-filetype-plugin-indent-on-and-filetype-indent
filetype plugin indent on

" set Vim-specific sequences for RGB colors (fixes color bug)
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"

" fixes glitch? in colors when using vim with tmux
set background=dark
set t_Co=256

" make colors look better
set termguicolors 

" enable italic text
let g:gruvbox_italic = '1' 

"Set colorscheme to gruvbox
colorscheme gruvbox

" Turn on syntax highlighting
syntax on

" Show line numbers
set number

" Show file stats
set ruler

" Blink cursor on error instead of beeping (grr)
set visualbell

" Enable Mouse
set mouse=a

" show tabs as 4 spaces
set tabstop=4

" convert tabs to spaces
set expandtab 

" stop line wrapping (or something similar)
set nowrap 

" make side scrolling less jumpy
set sidescroll=1

" Enter inserts new line in normal mode
nmap <S-Enter> O<Esc>
nmap <CR> o<Esc>

J'ai aussi décommenté une ligne dans mon bash:

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes

Taper "$ TERM" dans et hors de tmux renvoie la valeur "screen-256color".

Aussi, voici mon .tmux.conf:

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# split panes using | and -
bind \ split-window -h
bind - split-window -v
unbind '"'
unbind %

# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# Enable mouse mode (tmux 2.1 and above)
set -g mouse on


#256 Color Support?
set -g default-terminal "screen-256color"
Roymunson
la source

Réponses:

0

Testé avec du mastic> ubuntu, centos, macos> tmux [2.7,3.1]> vim 8.1

$ tmux -2 # force tmux to use 256 colors.
mosh
la source