Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change the background color of the empty tab space in vim?

In vim, when you create a new tab, the tab bar appears at the top of the screen. On the left are all your tabs, on the far right is an "X" for closing the tabs. In between, there is "empty" space, that on my screen appears white.

I'll admit, I'm very picky about how my terminal looks, and this bright white bar at the top of the screen is distracting. Is it possible to change this color to black, or maybe even gray?

like image 403
Cory Klein Avatar asked Jan 18 '11 17:01

Cory Klein


People also ask

How do I change the background color in Vim?

The ctermfg=white is used to set the foreground color to white in a terminal text editor. Finally, the ctermbg=black is used to set the background color to black in a terminal text editor.

What are the default Vim color schemes?

The default Vim color scheme in a light terminal is peachpuff . If you use a dark terminal, the initial color scheme is ron .

How do I make dark mode in Vim?

In Vim, if your color scheme supports both a light and dark mode, you switch between by using the command: set background=dark or set background=light . In Alacritty, you can define multiple color schemes and switch between them easily in the config file alacritty.

How do I show tabs in Vim?

In NORMAL mode, type /\t and hit <Enter> .


2 Answers

TLDR;

For a black tab bar (color 0)

:hi TabLineFill term=bold cterm=bold ctermbg=0

Explanation

Use vim's highlight command to set the attributes you want on the TabLineFill group.

This command will show you a list of all the current groups and their highlight attributes.

:hi

Find TabLineFill, and next to it you will see a preview of how your "tab line" will appear. Also note the attributes on this line.

In order for the color you want to be displayed, the attribute representing your terminal needs to be set to "bold". The two options are "term" and "cterm". If your using vim in a color terminal, then cterm will apply, otherwise term will apply. Set these attributes to bold like this:

:hi TabLineFill term=bold cterm=bold

The attribute "ctermbg" may or may not appear on the TabLineFill line, but it is used to define the color of the terminal background. See the list of cterm-color options by typing:

:help cterm-colors

Choose a color (for unobtrusive, I recommend 0, which is Black), then set the ctermbg attribute to the code for that color:

:hi TabLineFill ctermbg=0

This can all be combined into one single command:

:hi TabLineFill term=bold cterm=bold ctermbg=0
like image 117
Cory Klein Avatar answered Oct 04 '22 11:10

Cory Klein


Try the following: (you can put that in your .vimrc)

:hi TabLineFill ctermbg=100

you can play with the colors and choose one that you like.

like image 36
skeept Avatar answered Oct 04 '22 11:10

skeept