Summary: | vimrc default colorscheme | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Steven Wagner <stevenwagner> |
Component: | Current packages | Assignee: | 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
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. 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? 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. 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.
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 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 :) Closing this one as UPSTREAM. It's something that miiiiiiight make it into vim7, maybe. |