From 6932873ac0c36c501ae49faa0294af40ad01ada1 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Sat, 4 Nov 2023 13:39:50 +1100 Subject: [PATCH] Simplify termguicolors handling --- dot-config/vim/init.vim | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dot-config/vim/init.vim b/dot-config/vim/init.vim index a8e0cc6..ed3e6bd 100644 --- a/dot-config/vim/init.vim +++ b/dot-config/vim/init.vim @@ -18,11 +18,10 @@ if !isdirectory($XDG_CACHE_HOME .. '/vim/pack') PackUpdate endif -if has('gui_running') || has('termguicolors') - if $COLORTERM == 'truecolor' - &t_8f = "\[38:2:%lu:%lu:%lum" - &t_8b = "\[48:2:%lu:%lu:%lum" - endif +# If both Vim and the terminal it's running in support true colour, use it. +# Otherwise we just fall back to 256-colour mode, or even the old 16-colour +# mode if necessary! +if has('termguicolors') && $COLORTERM == 'truecolor' set termguicolors endif