Incorrect colors with vim in iTerm2 using Solarized

后端 未结 11 1088
傲寒
傲寒 2020-12-07 07:43

I am having a strange issue with iTerm2, in terminal vim (non-gui) and the solarized color scheme. First, I have set iTerm2 to use the dark solarized colour scheme.

相关标签:
11条回答
  • 2020-12-07 08:02

    This worked for me in OS X 10.9.1 in iTerm 2 as well as Terminal. One mistake I was making was putting the colorscheme declaration before the termtrans and termcolors settings (and I needed both of these to make it work). As others have said, I set my terminal type to xterm-256color

    if !has("gui_running")
        let g:solarized_termtrans=1
        let g:solarized_termcolors=256
    endif
    
    colorscheme solarized
    set background=dark
    
    0 讨论(0)
  • 2020-12-07 08:06

    None of the previous answers worked for me. Apparently I was missing:

    set termguicolors
    
    0 讨论(0)
  • 2020-12-07 08:10

    For any still having issues like I was, I had installed iterm2 solarized color profile. Installing vim-color-solarized to vim bundles and following the instructions was unnecessary and was incompatible. There were funny highlighting issues like in the screen capture above.

    Lesson learned: don't do both.

    0 讨论(0)
  • 2020-12-07 08:13

    From the creator: http://ethanschoonover.com/solarized/vim-colors-solarized

    IMPORTANT NOTE FOR TERMINAL USERS:

    If you are going to use Solarized in Terminal mode (i.e. not in a GUI version like gvim or macvim), please please please consider setting your terminal emulator’s colorscheme to used the Solarized palette. I’ve included palettes for some popular terminal emulator as well as Xdefaults in the official Solarized download available from Solarized homepage. If you use Solarized without these colors, Solarized will need to be told to degrade its colorscheme to a set compatible with the limited 256 terminal palette (whereas by using the terminal’s 16 ansi color values, you can set the correct, specific values for the Solarized palette).

    If you do use the custom terminal colors, solarized.vim should work out of the box for you. If you are using a terminal emulator that supports 256 colors and don’t want to use the custom Solarized terminal colors, you will need to use the degraded 256 colorscheme. To do so, simply add the following line before the colorschem solarized line:

    let g:solarized_termcolors=256

    Again, I recommend just changing your terminal colors to Solarized values either manually or via one of the many terminal schemes available for import.

    0 讨论(0)
  • 2020-12-07 08:16

    I tried all of the previous suggestions. I just added set t_Co=256 to .vimrc and it was fixed. I didn't need to create a tmux alias or change my config file.

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