From 6d1d244f8b97afc57669186d85dc4ee465713f59 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Wed, 19 Aug 2020 18:41:42 +0200 Subject: [PATCH] Change vim colors script to not call updatecolors --- vim/plugin/colors.vim | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/vim/plugin/colors.vim b/vim/plugin/colors.vim index c405f72..4906005 100644 --- a/vim/plugin/colors.vim +++ b/vim/plugin/colors.vim @@ -15,16 +15,20 @@ augroup kitty au ColorScheme * call kitty_bg_color() augroup END +function! s:kitty_bg_color_reset() + if filereadable($HOME."/.dark") + let l:file = $HOME."/darkrc/kitty_dark.conf" + else + let l:file = $HOME."/darkrc/kitty_light.conf" + end + echom system("cat ".l:file." | grep background | sed -e 's/ /=/' | xargs kitty @ set-colors") +endfun + +command Test call kitty_bg_color_reset() + if $TERM=="xterm-kitty" augroup kitty - call system("which updatecolors") - if v:shell_error - let s:kitty_bg=system("kitty @ get-colors | grep ^background") - let g:kitty_bg=s:kitty_bg[match(s:kitty_bg, "#"):] - au VimLeavePre * echom system("kitty @ set-colors background=".g:kitty_bg) - else - au VimLeavePre * call system("updatecolors") - end + au VimLeavePre * call kitty_bg_color_reset() augroup END end