How can one make vim change terminal colors?
Posted
by
amn
on Super User
See other posts from Super User
or by amn
Published on 2013-11-04T09:27:55Z
Indexed on
2013/11/04
10:01 UTC
Read the original article
Hit count: 303
I am using command line vim
running from an xterm
(which runs sh
). I have color in vim according to a color scheme I like. The problem is, as usual with 256-color terminals and truecolor color schemes, colors are wrong. Now, I know I can do a gazillion things to fix this, including installing gvim
, but I like my terminal.
In fact, using xrdb [-merge] .Xresource
file, I now actually have xterm
override the color values, and the theme now looks perfect.
Since, I may be switching to another theme, I need some workflow to have vim actually do what xrdb
does - to reset terminal color pallette. Because right now I have to reset color values with xrdb ...
first, then launch another xterm
to actually use these values, then launch vim
from that newly opened xterm
to have the exact colors. The way I understood it is that vim
color scheme, just as any other terminal application, uses colors by referencing their ids, and X resources set the values themselves.
I think I saw somewhere on Internet, that terminal control character sequences can reset actual color values, in fact, I am sure they can - I managed to set my terminal background color at runtime. How would I make vim
execute these sequences to match values for the color scheme? And is there any reference to these control sequences, as part of any standard?
© Super User or respective owner