14

Is there a way to set different colors for the command line color and the "Normal" text color in vim. When I use

:hi Normal guifg=orange

the command line and the normal text color become orange. I would like the command line at the bottom of the gui to be a different color however.

1
  • I guess this line is called the cmdline. So its statusline and below it is cmdline. Correct me if im wrong. And I was trying to post this as a feature request on www.vim.org. No such option. Commented Dec 18, 2023 at 10:52

4 Answers 4

11

Nowadays NeoVim has the feature. MsgArea color group. e.g.

:hi MsgArea guifg=#03ff13

screenshot

Sign up to request clarification or add additional context in comments.

1 Comment

this works in neovim!!
7

No, not that I know of.

Not without messing with Vim's source.

The command line is under Normal highlighting group.

Comments

3

This can be done with autocommands:

hi Normal=white guifg=white
au CmdLineEnter * hi Normal ctermfg=cyan guifg=cyan
au CmdLineLeave * hi Normal ctermfg=white guifg=white

Surprisingly to me, this only affects the CmdLine, not everything else.

I had expected all the normal text to change color immediately when entering the CmdLine. Without the CmdLineLeave, the change to the normal text everywhere happens, but only after getting out of the command line; which explains why it does what we want.

Note that I am using vim from a terminal, so I am using ctermfg instead of guifg; but I anticipate that it will work the same way with a gui version of vim.

You may also want to highlight the ModeMsg.

Comments

3

That can be done via new wincolor option that was introduced in Vim 8.2:

set wincolor=NormalAlt
autocmd WinEnter set wincolor=NormalAlt
hi Normal       guifg=#CED1CF       guibg=#000000       gui=NONE
hi NormalAlt    guifg=#CED1CF       guibg=#1B1D21       gui=NONE

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.