From 811e10f04de4a9d84cfebeb808617a4a97fd0b72 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Mon, 7 Nov 2022 22:18:26 +0300 Subject: [PATCH] dotfiles/vimrc: fix truecolor support I never really knew why the colors looked different inside and out of tmux. Now they look correct everywhere! See: https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6 --- dotfiles/vimrc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dotfiles/vimrc b/dotfiles/vimrc index 7596732..fd040cd 100644 --- a/dotfiles/vimrc +++ b/dotfiles/vimrc @@ -11,10 +11,17 @@ filetype on " enable file type detection filetype plugin on " enable file type plugins filetype indent on " enable file type indents -set background=dark -" restrict vim to 16 ANSI colors in the palette instead of approximating 256 -set t_Co=16 +" You might have to force true color when using regular vim inside tmux as the +" colorscheme can appear to be grayscale with "termguicolors" option enabled. +" See: https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6 +if !has('gui_running') && &term =~ '^\%(screen\|tmux\)' + let &t_8f = "\[38;2;%lu;%lu;%lum" " set foreground color + let &t_8b = "\[48;2;%lu;%lu;%lum" " set background color +endif + colorscheme selenized +set termguicolors +set background=dark " for per-directory vimrc files " see: https://jezenthomas.com/how-i-write-invoices-in-vim/