Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 56290

Summary: vimrc default colorscheme
Product: Gentoo Linux Reporter: Steven Wagner <stevenwagner>
Component: Current packagesAssignee: Vim Maintainers <vim>
Status: RESOLVED UPSTREAM    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: xterm-191-fgbg.patch

Description Steven Wagner 2004-07-06 17:04:38 UTC
can we add...
colorscheme elflord
into the default vimrc we have for the user in /etc/vim/vimrc.
The currently selected colorscheme is difficult for a lot of people to see, and the colorscheme elflord is the same thing but with a much better contrast.
Comment 1 Ciaran McCreesh 2004-07-06 17:12:05 UTC
The default colour scheme is only unreadable if your terminal emulator doesn't report whether it's light or dark properly :) Read :help 'background' for details.

Also, if I were to change it, I'd probably go for darkblue rather than elflord.
Comment 2 Steven Wagner 2004-07-06 20:16:22 UTC
I see what you mean. I can just leave the colorscheme at its default now and type :set bg=dark   and everything becomes readable?  How do I fix my terminal emulator though?  Is it losing this variable when I ssh through multiple servers to launch vim remotely?
Comment 3 Ciaran McCreesh 2004-07-12 11:05:36 UTC
Well, Aron (agriffis) has a rather nice little bash trick which makes this work with Xterm-based terminals (rxvt-based terminals should just work). Unfortunately, it's not entirely perfect, so we can't include it yet. For now I suggest adding in a :set background statement to your .vimrc.
Comment 4 Aron Griffis (RETIRED) gentoo-dev 2004-07-15 11:49:30 UTC
Created attachment 35494 [details, diff]
xterm-191-fgbg.patch

The attached patch causes xterm to export two environment variables:
   XTERM_FOREGROUND and XTERM_BACKGROUND

Each is of the form #RRGGBB, for example with a black background and grey
foreground, the variables might be
   XTERM_BACKGROUND="#000000"
   XTERM_FOREGROUND="#BEBEBE"

The patch isn't perfect.  In particular it generates compiler warnings that I
don't understand because I'm not familiar enough with the X11 API and the
existing xterm code.  But the patch works, so it's as far as I'll take it.

We might consider using this patch, or a variant thereof, in our xterm ebuild. 
I'm going to ask Thomas Dickey, the current maintainer of xterm, to take a look
and consider including it in xterm.  He might have some very good reasons to
refrain from including it, but either way, we should learn something.
Comment 5 Aron Griffis (RETIRED) gentoo-dev 2004-07-15 11:51:51 UTC
Oh btw, that is *not* the bash trick Ciaran mentioned.  That bash trick is really gross so I don't recommend it.  Here is the code if you are really interested.  But the xterm patch is a much better idea.

case "$TERM" in
  xterm*) 
    if [[ $DISPLAY == :* ]]; then
      export XTERM_BACKGROUND=$(xrdb -query \
        | awk '$1=="XTerm*background:"{print $2;exit}')
      if [[ $XTERM_BACKGROUND == '#'* ]]; then
        # resolve XTERM_BACKGROUND from rgb.txt
        XTERM_BACKGROUND=$(
          rgb="$((0x${XTERM_BACKGROUND:1:2}))"            # red octet
          rgb="$rgb $((0x${XTERM_BACKGROUND:3:2}))"       # green octet
          rgb="$rgb $((0x${XTERM_BACKGROUND:5:2}))"       # blue octet
          showrgb | awk -F\\t -v rgb="$rgb" \
            '$1==rgb{print $NF;exit}END{print ENVIRON["XTERM_BACKGROUND"]}')
      fi
    fi
    ;;
esac
Comment 6 Ciaran McCreesh 2004-07-31 03:15:13 UTC
Having looked at the code a bit more, the only supported terminal type for background detection right now is the Linux console. Time for a patch methinks :)
Comment 7 Ciaran McCreesh 2005-01-21 09:34:00 UTC
Closing this one as UPSTREAM. It's something that miiiiiiight make it into vim7, maybe.