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
This commit is contained in:
Alan Orth 2022-11-07 22:18:26 +03:00
parent 188e055677
commit 811e10f04d
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

View File

@ -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 = "\<Esc>[38;2;%lu;%lu;%lum" " set foreground color
let &t_8b = "\<Esc>[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/