Skip to content

Terminal specific

Tony Andrys edited this page Sep 13, 2017 · 21 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. Also see this Gist 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.

You can’t perform that action at this time.