It's important that a theme set the g:colors_name
variable correctly to match the name of the theme script file, because Vim will use it when it needs to reload the theme (and it does so in a few situations.)
I could find at least one cobalt2
theme online that had a commit fixing it from incorrectly setting the variable to cobalt
, to setting it correctly as cobalt2
.
See this commit, which is the latest commit in theme cobalt2
available as Vim package GertjanReynaert/cobalt2-vim-theme
.
It's the latest commit of that repo, but it's dated of over five years ago, 2015, so I'm not sure how you would end up with that repo but an older version of that...
In any case, try to update your cobalt2
theme to the latest. If you're already on the latest, look inside the colors/cobalt2.vim
script inside it and see how it sets colors_name
. If it sets it incorrectly, you can fix it there (and hopefully report it to the maintainer of the source where you got it, so it can be fixed there too.)
syntax enable
is commented out, do you still get any colorscheme when you open a file in ViM? If you dols /usr/share/vim/vim81/colors
, that will display a list of all available color schemes you have available to you. Maybe double check the one you want exists?cobalt2
exists and I'm able to apply it after commenting out thesyntax enable
as mentioned above.synload.vim
, line 19 isexe "colors " . colors_name
. Since I don't have the cobalt color scheme, when I'm in vim and I type:colors cobalt
I get the same error you see. I did a grep for the variablecolors_name
in/usr/share/vim/vim81
and got all the colors .vim files defining that global variable. Can you confirm that your/usr/share/vim/vim81/colors/cobalt2.vim
defines thecolors_name
variable ascobalt2
?