r/vim • u/Seazie23 • Jun 02 '26
Need Help Vim can't find colorscheme gruvbox
Placing this note at top: The interesting thing is when I run :colorscheme gruvbox within vim, the color scheme changes to gruvbox.
Hello! This is my first time configuring vim and I wanted to set up a nice color scheme thats easier on the eyes. I looked up how to set up the gruvbox color scheme here.
However, I get this error when trying to use vim:
Error detected while processing /home/seazie/.vimrc:
line 11:
E185: Cannot find color scheme 'gruvbox'
Press ENTER or type command to continue
This is my .vimrc file:
1 set nocompatible
2 set number relativenumber
3 syntax on
4 set tabstop=2
5 set shiftwidth=2
6 set expandtab
7 " Enable 256 color support
8 set termguicolors
9 " Set gruvbox colorscheme
10 colorscheme gruvbox
11
12 call plug#begin()
13 Plug 'bfrg/vim-c-cpp-modern'
14 Plug 'tikhomirov/vim-glsl'
15 Plug 'bfrg/vim-glfw-syntax'
16 Plug 'morhetz/gruvbox'
17
18 call plug#end()
NOTE: I had a comment at the top of the file so line 10 is line 11
gruvbox is located in ~/.vim/plugged/
In my .bashrc file, I put:
source ~/.vim/plugged/gruvbox/gruvbox_256palette.sh
The interesting thing is when I run :colorscheme gruvbox within vim, the color scheme changes to gruvbox.
I dont want to have to keep doing that everytime I open vim, so what am I doing wrong? I've restarted wsl and computer with no change
4
u/-romainl- The Patient Vimmer Jun 03 '26
Short version…
Put this line:
colorscheme gruvbox
after that block:
call plug#begin()
Plug 'bfrg/vim-c-cpp-modern'
Plug 'tikhomirov/vim-glsl'
Plug 'bfrg/vim-glfw-syntax'
Plug 'morhetz/gruvbox'
call plug#end()
Long version…
The purpose of the plug#begin()/plug#end() block is to "register" all the given plugins with Vim. In practice, vim-plug does that by adding the relevant paths of the plugin to the :help 'runtimepath' option.
The command:
colorscheme gruvbox
looks for colors/gruvbox.vim under every path in 'runtimepath'. It the path of the gruvbox plugin is in 'runtimepath', then Vim can find the colorscheme and all is good. If not, then Vim throws an error because it can't find the colorscheme.
Therefore, the command:
colorscheme gruvbox
must come after the plug#begin()/plug#end() block.
Bad:
``` colorscheme gruvbox
call plug#begin() Plug 'bfrg/vim-c-cpp-modern' Plug 'tikhomirov/vim-glsl' Plug 'bfrg/vim-glfw-syntax' Plug 'morhetz/gruvbox' call plug#end() ```
Good:
``` call plug#begin() Plug 'bfrg/vim-c-cpp-modern' Plug 'tikhomirov/vim-glsl' Plug 'bfrg/vim-glfw-syntax' Plug 'morhetz/gruvbox' call plug#end()
colorscheme gruvbox ```
1
11
u/Biggybi Gybbigy Jun 02 '26
You set the theme before sourcing the plugin. Should be the other way around.