Terminal specific - morhetz/gruvbox GitHub Wiki

If you're using GUI version of vim that should be enough. Otherwise let me guide you through the hell of terminal specific issues.

First of all you should check this screenshot, as how it shouldn't look: Screenshot

Issues

1. Italics is disabled

Most terminals don't handle italics right so gruvbox disables italics for terminals by default. But if you're using urxvt or gnome-terminal you should try setting let g:gruvbox_italic=1 before colorscheme gruvbox to enforce displaying italics

2. Colors are off

By default gruvbox will act as usual 256-color theme, but colors wouldn't be that vivid due to limitations of 256-palette. Compare the wrong screenshot above with README preview or any from the Gallery. The difference isn't edgy, but pretty visible enough (changes in red color and shades of gray should be most noticeable). You could run vim in terminal and GUI version side by side.

There are four possible ways to get right colors at the terminal:

  • using neovim/recent vim
  • using 256-color gruvbox palette shellscript
  • using terminal 16-color base colorscheme
  • using urxvt-256-xresources
0. (Recommended) Neovim/Vim True Color support

Neovim and recent Vim support true color terminal out of the box with just a single configuration option. No workarounds anymore. Just add

"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX) && getenv('TERM_PROGRAM') != 'Apple_Terminal')
  if (has("nvim"))
    "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
    let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  endif
  "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
  "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
  " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
  if (has("termguicolors"))
    set termguicolors
  endif
endif

to your Vim/Neovim configuration file to allow it to support Truecolor, which is usually your ~/.vimrc or your ~/.config/nvim/init.vim. Also see this repo for a list of supported terminals. These older, related sources might still be useful (note that Neovim previously used an environment variable instead of a configuration option to enable True Color support):

Neovim + iTerm2 + Truecolor = Awesome

True colour (24 bit) with Neovim, tmux and iTerm2

Neovim Gets True Color Support in the Terminal

a. 256-color gruvbox palette shellscript

Gruvbox contains shellscript (default and osx-iterm2 versions), which would overload system default 256-color palette with precise gruvbox colors. Try running terminal vim before and after executing this script to feel the difference. To avoid the necessity of reexecuting it each time you're opening terminal, you should start this script from .bashrc//.zshrc//.profile either like this:

source "$HOME/.vim/bundle/gruvbox/gruvbox_256palette.sh"

or, using version for old iTerm2 < 2.9 (modern iTerm builds are compatible with no-osx script):

source "$HOME/.vim/bundle/gruvbox/gruvbox_256palette_osx.sh"

where $HOME/.vim/bundle/ is your preferred plugin manager bundles installation path

Edit: Doesn't work at Konsole, see issue #35.

b. terminal 16-color base colorscheme

This is a loose solution as you should set gruvbox as your terminal colorscheme and only 10 main colors of the whole gruvbox palette would be overloaded. But in the case of troubles with gruvbox-shellscript this is the only way to get precise colors at the terminal. First of all, let's define g:gruvbox_termcolors option at your .vimrc:

let g:gruvbox_termcolors=16

This way gruvbox would pick base colors right from your terminal colorscheme. Refer color.table for gruvbox ↔ termcolors correlation. Next thing you'd need is gruvbox terminal colorscheme. You could pick both dark and light Xresources versions from gruvbox-generalized repo. iTerm2 colorschemes are also there.

c. urxvt-256-xresources

If you're on Arch Linux and using urxvt-256-xresources you could try setting 256-color gruvbox palette at your Xresources same way as it's provided at gruvbox-generalized repo. Take a look at gruvbox-urxvt256.xresources for details. This should do the same thing as gruvbox 256-color palette shellscript, but the result would be fixed to urxvt only.

Troubleshooting

1. Effect of gruvbox_256palette.sh gets reset on Alt-Tab

That's known issue with Ubuntu GTK-themes and//or VTE-based terminals. Refer for more details. Known affected terms are Gnome Terminal, Terminator and Lilyterm and probably more VTE-based. Though, with Lilyterm option 'Dim text when inactive' set off, everything works fine. There is no known solution//workaround to fix this. If you're disappointed with such behavior, please report issues to terminal developers, there no thing I can currently do with that.