lose vim colorscheme in tmux mode

后端 未结 20 1738
说谎
说谎 2020-12-12 09:13

I\'m running iterm2 and when I\'m in tmux mode the colorscheme I have set in vim does not show up. Only the color scheme I\'ve set in iterm. If I run vim from shell the colo

相关标签:
20条回答
  • 2020-12-12 09:41

    I've removed the line set termguicolors, but it doesn't work. Setting set notermguicolors instead in the .vimrc works.

    0 讨论(0)
  • 2020-12-12 09:41

    Using these two lines in my .tmux.conf worked for me, I'm using Ubuntu 20.04 with Alacritty.

    set  -g default-terminal "tmux-256color"
    set -ag terminal-overrides ",alacritty:RGB"
    

    Found them in an issue on alacitty's repo, in the comment provided by YodaEmbedding:

    https://github.com/alacritty/alacritty/issues/109

    0 讨论(0)
  • 2020-12-12 09:42

    I needed vim to display correctly with tmux in terminal on ubuntu and cygwin/mintty on windows. I got it to work by combining the answers like this.

    In .bashrc:

    alias tmux="tmux -2"
    

    In .vimrc:

    " use 256 colors in terminal
    if !has("gui_running")
        set t_Co=256
        set term=screen-256color
    endif
    
    " fix cursor display in cygwin
    if has("win32unix")
        let &t_ti.="\e[1 q"
        let &t_SI.="\e[5 q"
        let &t_EI.="\e[1 q"
        let &t_te.="\e[0 q"
    endif
    

    based on answers from this question, this Vim wiki page and this block cursor question

    0 讨论(0)
  • 2020-12-12 09:43

    As @romainl mentions above, I needed to force tmux to use 256 colors by adding the -2 flag:

    $ tmux -2
    

    I added alias tmux='tmux -2' to my bash_profile, so, I don't forget :)

    0 讨论(0)
  • 2020-12-12 09:45

    Adding the following line in .tmux.conf worked for me with macOS Sierra 10.12.6,

    set -g default-terminal "screen-256color"

    0 讨论(0)
  • 2020-12-12 09:45

    I am using Ubuntu bionic 18.04.4 LTS and tmux 2.6. I have the same issue and it can be resolved by simply adding this into .bashrc

    export TERM=screen-256color
    

    And ofcourse don't forget to source it. source ~/.bashrc

    Or just restart your teminal

    0 讨论(0)
提交回复
热议问题