Recently, I have tried to create my own colorscheme in only one color and no text decoration. That means Normal, Comment, ToolbarLine, Tooltip... are the same; Visual, Cursor... are reversed, of course; no bold, no underline, no italic found.

Every built-in highlighting is successfully overwritten to one color, I pick green color for testing: Normal mode

Expected highlighting

Because there are many unexpected name of highlighting, so there are still some colorful highlighting:

Unexpected highlighting

How to overwrite color for not built-in highlighting?

  • Welcome to Vi and Vim! I'm not quite sure I follow: you wanted to create a mono-chromatic colorscheme, so you highlighted the highlight-default groups. From there, you realized there were other groups that don't get overwritten, and you want to override those? Generally, you have to discover them and overwrite them. I wonder if you could do it programmatically, parsing the output of :hi or :syn list
    – D. Ben Knoble
    Commented Nov 9, 2019 at 15:39
  • Yes, you got my expectation. Is parsing the output the only way to solve my problem?
    – ne3suszr
    Commented Nov 9, 2019 at 15:46
  • 1
    It's cleaner to use getcompletion('', 'highlight'). But, in general, color schemes should not touch such "user" groups at all. Note, for example, that you'll depend on the load order (color scheme vs. LightLine plugin).
    – Matt
    Commented Nov 9, 2019 at 15:48
  • Good call @Matt. ThinkMatic, you have other options (such as only touching the groups you care about). For example this (horrible) colorscheme of mine just links syntax-related groups. Dracula does something similar. [Thanks for reminding me I had left those zelda schemes unfinished lol]
    – D. Ben Knoble
    Commented Nov 9, 2019 at 15:57

2 Answers 2


You can try this vimscript (add to your vimrc and call SetHLGreen() function)

"" Get all highlights in a raw string
fun! GetHLStr()
    redir => all_hl
    redir END
    return all_hl

"" Set all known highlight groups to green
fun! SetHLGreen()
    " get highlight groups without printing it in vim
    silent let hl_str = GetHLStr()

    " make list of highlight groups
    let hl_list = split(hl_str, '\n')

    " remove non highlight groups (parts of prev highlight group definition)
    call filter(hl_list, {_,v -> v !~ '^\s.*'})

    " extract just the highlight group names
    call map(hl_list, {_,v -> matchstr(v, '^\S\+')})

    " set all highlight groups foreground to "green"
    for hl_group in hl_list
        exe 'hi ' . hl_group . ' guifg=green ctermfg=green'

PS, it looks like this:

enter image description here

PPS, it is even easier with getcompletion func (didn't know about it, thx @Matt)

"" Set all known highlight groups to green
fun! SetHLGreen()
    " set all of highlight groups to "green"
    for hl_group in getcompletion('', 'highlight')
        exe 'hi ' . hl_group . ' guifg=green ctermfg=green'
  • What this is should be the default. You should have to do work to get it to have dinky colours. Thanks, Maxim, I am gonna do this myself.
    – Benjamin R
    Commented Apr 30, 2020 at 7:09

Most filetypes (like python) in Vim come with a syntax that defines highlight groups (see them via :highlight python<C-d>). These particular groups (e.g. pythonFunction) are then linked to a set of default groups (:help highlight-groups, e.g. Identifier). A colorscheme then provides combinations of foreground / background color and/or formatting like bold and italic (separately for terminals, color terminals, and/or GVIM) for the default groups.

Plugins are also encouraged to link to existing default groups; after all, these adhere to the user's preferred style and will work under whatever conditions (low-color / high-color terminal / GUI, bright / dark) the user has. However, some plugins either provide functionality that has no existing related concept in Vim, or they need a highlighting that is relatively independent of user choices (like red / green for test results; those should always look red / green even if the user prefers bluish hues).

So what you see is that Lightline plugin not linking to the default groups. That plugin should use :help :highlight-default, so you can override its custom definitions (with greenish ones) with :highlight LightlineLeft_replace_1 ... in your ~/.vimrc (you can always overwrite them later, e.g. on VimEnter). Yes, that's a lot of definitions there (but apparently mostly combinations of a few base colors and text attributes, and you want just green, anyway), but this needs to be done only once, for this plugin and maybe a few more.

Alternatively, you could employ meta-programming and go over all :hi definitions after Vim startup (so plugins have added their definitions) and change them to green.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.