dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit d4fc16ef4b138a5c52fcb4abd20d44dbce1b7e43 (patch)
parent f671dcdce90383b167ae2c2f7f167dc658cd396a
Author: Alex Karle <alex@karle.co>
Date:   Fri,  2 Aug 2019 23:23:01 -0400

vim: more colorscheme fixes for detecting 256 colors

I was previously checking $DISPLAY to determine if I was in an xterm or
the Virtual Console (can't check $TERM =~ linux because of tmux).

This breaks down over SSH, where $DISPLAY is not set.

Solution: check $TERM =~ 256color and hope tmux set it properly.

Diffstat:
Mvim/vimrc | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/vim/vimrc b/vim/vimrc @@ -90,7 +90,8 @@ set listchars=space:·,tab:>–,trail:~,eol:¬ " COLORSCHEME " Only gruv if you can handle it -if exists("$DISPLAY") && +" NOTE: for initial check, check $TERM, not &term, as nvim has &term=nvim +if $TERM =~# '256color' && \ (has("termguicolors") || has('gui_running')) && \ filereadable(s:vimdir . "/pack/mine/start/gruvbox/colors/gruvbox.vim") @@ -98,6 +99,7 @@ if exists("$DISPLAY") && colorscheme gruvbox " See :h xterm-true-color for tmux+termguicolors + " TODO: is this safe to blindly set always (in 256 color mode)? if &term =~# '^\(tmux\|st\|screen\)' let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" @@ -110,6 +112,7 @@ if exists("$DISPLAY") && autocmd InsertEnter,InsertLeave * set cul! augroup END else + " Can't handle the gruv set background=light colorscheme vc endif