I see three sets of options for terminal colors on the vim documentation.
The first set of options:
t_AB set background color (ANSI) *t_AB* *'t_AB'*
t_AF set foreground color (ANSI) *t_AF* *'t_AF'*
The second set of options:
t_Sb set background color *t_Sb* *'t_Sb'*
t_Sf set foreground color *t_Sf* *'t_Sf'*
The third set of options:
t_RF request terminal foreground color *t_RF* *'t_RF'*
t_RB request terminal background color *t_RB* *'t_RB'*
t_8f set foreground color (R, G, B) *t_8f* *'t_8f'*
t_8b set background color (R, G, B) *t_8b* *'t_8b'*
I am somewhat puzzled. Why are there three sets of options, what is the difference between them?
I use vim in a terminal that its type is linux
. If I want to set the background color of vim in the terminal, which set of options should I use?
I saw the value of the t_AB
option by using the "set termcap
" command:
t_AB=^[[4%p1%dm
What does "^[[4%p1%dm
" mean? What color does it represent?
UPDATE:
I am using the xshell emulation terminal, and its current color scheme is set to "New black", the background color of this color scheme uses a dark gray
instead of black
. My vim color theme file is my_black.vim , the background color of the vimc window is set to black
in my_black.vim ; the code is as follows:
set background=dark
hi Normal ctermfg=119 ctermbg=Black
When I open the vim window in the xshell terminal, the background color of the vim window is dark gray
rather than black
that i configured in my_black.vim . The dark gray
is the background color of the xshell color theme configuration. The xshell also supports other color schemes: "ANISI colors onBlack","Pastel on black"; The background color of the screens background configured in these color schemes is black
, and my color theme file: my_black.vim works fine in these color schemes, but only "New black" does not work.
I hope that my vim color theme file is valid in any color configuration scheme of any terminal program, and is not interfered by the color configuration of the terminal program.
Therefore,I have an idea: first I go to get the background color of the current terminal screen by using the value of t_AB
or t_Sb
or t_8b
option in vimrc, and then customize my vim color theme configuration based on the value of t_AB
or t_Sb
or t_8b
option.
how does set a value to t_AB
or t_Sb
or t_8b
option? What should I do ?
TERM
set to? Have you tried to set it toxterm
orxterm-256color
? – Ralf Mar 25 at 5:26xterm
. – Ralf Mar 25 at 5:53termguicolors
is set.) – Ralf Mar 25 at 7:39