7

Is it possible to change the coloring for the command line in vim? I realize that may be somewhat ambiguously stated, so I have some things that should clear it up a little. This image illustrates what I'm talking about:

enter image description here

Shown are two lines of the file I'm editing, or in the particular case, the help file I'm viewing, then the status line and finally the command line I'm talking about. All I want to do is turn that command line's foreground and background colors to the same as the status line above it.

I would assume this is a simple hi ______ guifg=#… guibg=#… in my colorscheme file, I'm just not sure what the selector is for that line. Can anyone offer any help? I haven't seen this happening in any screenshots of other configs, so I'm not sure if it's impossible or just uncommon.

3 Answers 3

8

The Vim cmdline uses the same colors as Normal text and doesn't have its own highlight group.

0

I tested killistan's answer to a similar question with the following:

:hi Normal ctermbg=Black ctermfg=Black cterm=NONE
augroup
    au!
    au CmdLineEnter * hi Normal ctermfg=DarkGrey
    au CmdLineLeave * hi Normal ctermfg=Black
augroup END

And they are mostly correct. This will change the colors in the CmdLine only when you first enter it, after about four seconds, all text in the Normal group will change to match it. When you exit the CmdLine all text immediately changes back.

So, if you put something similar in your vimrc you could at least have the two matching while you were in the CmdLine.

0

As this answer to a related question states, Vim 8.2 added a new setting wincolor which can be used to do something similar to what you're asking.

In my .vimrc, I added:

set wincolor=NormalAlt
highlight Normal guibg=#1B1D21
highlight NormalAlt guibg=black

This makes the background of the text area black, but the commandline and a thin border around the text area is still the Normal color (i.e. #1B1D21).

The vim help file has this to say about wincolor:

Highlight group name to use for this window instead of the Normal color |hl-Normal|.

This seems to imply wincolor is meant to enable a per-window Normal color, so I'm not sure why it's applying to only to the command line and border. Maybe a bug (that we are currently using as a feature ;-) )? Or I'm misinterpreting the help file.

For neovim, there's this answer which states there's a new color group, MsgArea that can be used:

:hi MsgArea guifg=#03ff13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .