Windows 10 / babun / Ubuntu VM / tmux / neovim colors
My Windows 10 development setup includes vagrant and babun. Babun is an awesome Windows shell built on top of cygwin babun.github.io with oh-my-zsh. Throw in vagrant to manage development VMs, and I can do all my work via the command-line over SSH.
With tmux installed on the VM, I don’t need to install a resource-heavy desktop environment. The major downside is full terminal support from a cygwin shell inside of Windows. Things start to get complicated when running vim inside of tmux. Specifically, getting full 256 color support is not straight-forward. Throw in neovim instead of vim, and you need to take additional steps. There’s numerous Stackoverflow posts dating back to 2012 on how to fix the problem.
In your ~/.vimrc
This forces vim to use 256 colors. If the terminal doesn’t support 256 colors, then this config setting won’t work. Neovim ignores t_Co
.
You can determine how many colors the terminal supports with tput colors
.
In your ~/.tmux.conf
Will force tmux to emulate a screen 256 color terminal.
The arch Linux tmux wiki suggests running tmux -2
if the colors still don’t work.
Lastly, neovim appeared to be very picky with the TERM environment variable.
The environment variable
TERM
contains a identifier for the text window’s capabilities. You can get a detailed list of these capabilities by using theinfocmp
command… Text windows today typically support at least 8 colors. Often, however, the text window supports 16 or more colors, even thought theTERM
variable is set to a identifier denoting only 8 supported colors…
Setting the TERM variable in my ~/.zshrc
restored 256 color support