# Fix Vim Colorscheme Not Loading After vimrc Update
You update your .vimrc with a new colorscheme, restart Vim, and the colors do not change. The terminal still shows the default colors, or the colorscheme command produces an error:
E185: Cannot find color scheme 'gruvbox'Or worse, no error at all -- Vim simply ignores the colorscheme directive and continues with the default colors.
Step 1: Verify Colorscheme Installation
Check if the colorscheme files exist in Vim's runtime path:
:echo globpath(&runtimepath, 'colors/gruvbox.vim')If this returns nothing, Vim cannot find the colorscheme. For Neovim-compatible colorschemes, also check:
:echo globpath(&runtimepath, 'colors/gruvbox.lua')Step 2: Check Plugin Installation
If using a plugin manager, ensure the colorscheme plugin is installed:
```bash # For vim-plug ls ~/.vim/plugged/gruvbox/
# For packer (Neovim) ls ~/.local/share/nvim/site/pack/packer/start/gruvbox/ ```
If the directory does not exist, install the plugin:
```vim " For vim-plug, add to .vimrc: call plug#begin('~/.vim/plugged') Plug 'morhetz/gruvbox' call plug#end()
" Then install: :PlugInstall ```
Step 3: Colorscheme Loading Order
The colorscheme must be loaded after any plugin that defines it, and before any highlight commands that override it:
```vim " WRONG: colorscheme before plugin manager initialization colorscheme gruvbox call plug#begin('~/.vim/plugged') Plug 'morhetz/gruvbox' call plug#end()
" CORRECT: plugin manager first, then colorscheme call plug#begin('~/.vim/plugged') Plug 'morhetz/gruvbox' call plug#end()
colorscheme gruvbox ```
If you are using a plugin manager that lazy-loads plugins by filetype, the colorscheme plugin must NOT be lazy-loaded:
```vim " WRONG: lazy-loading the colorscheme Plug 'morhetz/gruvbox', { 'on': [] }
" CORRECT: always load the colorscheme Plug 'morhetz/gruvbox' ```
Step 4: Terminal Color Support
Even with a correctly installed colorscheme, the terminal must support the required number of colors:
:set t_Co?If this returns 8, the terminal only supports 8 colors. Most modern colorschemes require 256 colors. Fix this by setting the TERM environment variable:
export TERM=xterm-256colorAdd it to your ~/.bashrc or ~/.zshrc. Then in your .vimrc:
```vim if &t_Co < 256 set t_Co=256 endif
if has('termguicolors') set termguicolors endif ```
termguicolors enables true color (24-bit) support if your terminal supports it. Test terminal true color support:
curl -s https://raw.githubusercontent.com/JohnMorales/dotfiles/master/colors/true-colors.sh | bashIf you see a smooth gradient, your terminal supports true color.
Step 5: Conflicting Highlight Commands
Other plugins or manual highlight commands may override the colorscheme. Check:
:highlightLook for any highlight groups that do not match your colorscheme's expected values. Common conflicts:
" These in .vimrc can override the colorscheme:
highlight Normal guibg=Black
highlight Comment guifg=GrayMove any custom highlight commands after the colorscheme line in your .vimrc:
```vim colorscheme gruvbox
" Custom overrides AFTER colorscheme highlight Normal guibg=#1d2021 highlight CursorLine guibg=#3c3836 ```
Step 6: Verify Colorscheme Loading
After making changes, verify the colorscheme is loaded:
:colorscheme
" Should output: colorscheme gruvboxIf it shows default, the colorscheme directive was not executed or was overridden.
Debugging Colorscheme Load Path
To trace where Vim looks for colorschemes:
:set runtimepath?This shows all directories Vim searches for runtime files. The colorscheme must be in a colors/ subdirectory of one of these paths.
For a clean test, start Vim without any plugins:
vim -u NONE -c "set rtp+=~/.vim/plugged/gruvbox" -c "colorscheme gruvbox"If the colorscheme works in this minimal environment, the problem is in your .vimrc configuration order or a conflicting plugin.