Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xterm (Linux) vs iTerm2 - vim background behaves inconsistently with solarized *light* #140

Open
lkraav opened this issue Aug 14, 2011 · 1 comment

Comments

@lkraav
Copy link

lkraav commented Aug 14, 2011

iTerm2 uses "Solarized light" preset.

~/.Xresources on Linux, converted to solarized light according to instructions:

#define S_base03        #002b36
#define S_base02        #073642
#define S_base01        #586e75
#define S_base00        #657b83
#define S_base0         #839496
#define S_base1         #93a1a1
#define S_base2         #eee8d5
#define S_base3         #fdf6e3
#define S_yellow        #b58900
#define S_orange        #cb4b16
#define S_red           #dc322f
#define S_magenta       #d33682
#define S_violet        #6c71c4
#define S_blue          #268bd2
#define S_cyan          #2aa198
#define S_green         #859900

*background:            S_base3
*foreground:            S_base0
*fading:                40
*fadeColor:             S_base3
*cursorColor:           S_base01
*pointerColorBackground:S_base1
*pointerColorForeground:S_base01

!! black dark/light
*color0:                S_base2
*color8:                S_base3

!! red dark/light
*color1:                S_red
*color9:                S_orange

!! green dark/light
*color2:                S_green
*color10:               S_base1

!! yellow dark/light
*color3:                S_yellow
*color11:               S_base0

!! blue dark/light
*color4:                S_blue
*color12:               S_base00

!! magenta dark/light 
*color5:                S_magenta
*color13:               S_violet

!! cyan dark/light
*color6:                S_cyan
*color14:               S_base01

!! white dark/light
*color7:                S_base02
*color15:               S_base03

~/.vimrc everywhere:

call pathogen#runtime_append_all_bundles()
syntax enable
colorscheme solarized 

TERM=xterm-256color everywhere:

$ env | grep TERM
TERM=xterm-256color

On OS X locally, vim background autodetection works, background stays light.

On LinuxA locally, solarized light background is detected as dark, solarized.vim loads dark scheme.

  • set background=light also loads dark scheme
  • set background=dark loads light scheme
  • let g:solarized_termtrans=1 makes backgrounds correct, but hilights like cursorline and line numbers column are still reversed

vim -D reveals this is where background changes to wrong color on LinuxA locally:

...
/home/leho/Documents/vim-colors-solarized.git/colors/solarized.vim
line 539: exe "hi! Normal"         .s:fmt_none   .s:fg_base0  .s:bg_back
>n
/home/leho/Documents/vim-colors-solarized.git/colors/solarized.vim
line 539: hi! Normal cterm=NONE term=NONE ctermfg=11 ctermbg=15
>n
... (now background is wrong)

When I ssh from this LinuxA into another box LinuxB, background works correctly:

...
/secure/home/leho/dev/workspace/solarized.git/vim-colors-solarized/colors/solarized.vim
line 539: exe "hi! Normal"         .s:fmt_none   .s:fg_base0  .s:bg_back
>
/secure/home/leho/dev/workspace/solarized.git/vim-colors-solarized/colors/solarized.vim
line 539: hi! Normal cterm=NONE term=NONE ctermfg=12 ctermbg=8
>
....(background is OK)

Yet when I ssh from this LinuxA to OS X, background fails:

...
/Volumes/leho/dev/workspace/solarized.git/vim-colors-solarized/colors/solarized.vim
line 539: exe "hi! Normal"         .s:fmt_none   .s:fg_base0  .s:bg_back
>```
/Volumes/leho/dev/workspace/solarized.git/vim-colors-solarized/colors/solarized.vim
line 539: hi! Normal cterm=NONE term=NONE ctermfg=11 ctermbg=15
>
... (now background is wrong)

sshing from OS X results are exactly in reverse. seems to play into the fact that LinuxA has dark=light and vice versa going on even just locally.

Recap:

  • OS X iTerm2 local = success
  • LinuxA xterm local = fail
  • ssh LinuxA -> LinuxB = success
  • ssh LinuxA -> OS X = fail
  • ssh OS X -> LinuxA = fail
  • ssh OS X -> LinuxB = success

Any thoughts what to do with this? How to fix background reversing on LinuxA and xterm, first of all?

EDIT: gvim background works correctly on LinuxA! no idea if that has anything to do with console vim sanity.

@lkraav
Copy link
Author

lkraav commented Aug 25, 2011

executing

 :hi! Normal cterm=NONE term=NONE ctermfg=12 ctermbg=8

works for switching to light background.

i also noticed on my otherwise working LinuxA local configuration, sudo vim would also have incorrect background detection. visudo:

 Defaults env_keep += "COLORFGBG"

fixed that. i have a feeling forwarding this env variable through ssh is solution to my other woes as well.

http://www.sslug.dk/~chlor/vim-set-background-auto.html

cflipse added a commit to cflipse/dotfiles that referenced this issue Jun 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant