When to load colorscheme/highlights

I’ve been having a few hiccups with my colorscheme (GitHub - norcalli/nvim-base16.lua: Programmatic lua library for setting base16 themes in Neovim.) and custom highlight groups.

Should the colorscheme be loaded first, or last among the plugins? Things like gitsigns, galaxyline before or after the colorscheme?

I know that when I tried to add a custom highlight for white space, it wouldn’t work unless it came after the colorscheme. So colorscheme first then overrides after.

1 Like

To be safe you can use the ColorScheme autocmd:

function! SetHighlights() abort
  highlight ....
endfunction

autocmd ColorScheme * call SetHighlights()
2 Likes