Skip to content
rbong edited this page May 30, 2019 · 24 revisions

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 set termguicolors to your $MYVIMRC.

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"

If you are using fish, simply run the script using bash in $HOME/.config/fish/config.fish:

bash "$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.

This does not work with 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.

2. True colors look off

First, ensure your terminal supports true colors. You can find some terminals that support true color and read about testing for true colors here.

Next, try setting your TERM environment variable to xterm-256color. You may have to set t_8f and t_8b as appropriately if you cannot permanently set TERM to this value, such as in tmux. See :help xterm-true-color for more information.

If colors still look off, try testing with a minimal $MYVIMRC containing only gruvbox and set termguicolors. A plugin may be overriding highlighting or other settings.

3. Colors look off in tmux

Completely close all instances of tmux and set the following in .tmux.conf:

set -g default-terminal "tmux-256color"
set-option -ga terminal-overrides ",tmux-256color:Tc,xterm-256color:Tc"

Try launching tmux with TERM=xterm-256color tmux so the TERM environment variable is set properly before entering tmux.

If you are using true colors, make sure you follow the true color instructions above. Test true colors in your shell outside of Vim both in tmux and outside of tmux to ensure that true colors work outside of Vim.

Make sure you are using at least tmux 2.6 for true colors. You can check the version of tmux using the command tmux -V.