2020-05-18 14:32:01 +00:00
|
|
|
let g:only_generic_hl=1
|
|
|
|
|
2024-02-28 22:21:58 +00:00
|
|
|
function! s:term_bg_color()
|
|
|
|
let l:num_color=synIDattr(hlID("normal"), "bg")
|
2021-12-21 14:45:37 +00:00
|
|
|
if $TERM=="xterm-kitty" || $KITTY_LISTEN_ON != ""
|
2020-08-17 13:54:59 +00:00
|
|
|
if l:num_color!=""
|
2023-05-08 13:51:51 +00:00
|
|
|
if match(l:num_color, "^\\d\\{3}$")==0
|
|
|
|
let l:color=system("kitty @ --to $KITTY_LISTEN_ON get-colors | grep 'color".l:num_color."'")
|
|
|
|
let l:color=l:color[match(l:color, "#"):]
|
|
|
|
elseif match(l:num_color, "^#\\x\\{6}$")==0
|
|
|
|
let l:color=l:num_color
|
|
|
|
end
|
2023-05-09 11:34:04 +00:00
|
|
|
call jobstart('kitty @ --to $KITTY_LISTEN_ON set-colors background="'.l:color.'"')
|
|
|
|
call jobstart("cat ".$HOME."/darkrc/kitty_".&bg.".conf | grep cursor | sed -e 's/ /=/' | xargs -L 1 kitty @ --to $KITTY_LISTEN_ON set-colors")
|
2020-08-17 13:54:59 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
endfun
|
2021-12-21 14:45:37 +00:00
|
|
|
|
2024-02-28 22:21:58 +00:00
|
|
|
augroup termcolors
|
|
|
|
au ColorScheme * call <SID>term_bg_color()
|
2020-08-17 13:58:45 +00:00
|
|
|
augroup END
|
2020-08-17 13:54:59 +00:00
|
|
|
|
2024-02-28 22:21:58 +00:00
|
|
|
function! s:term_bg_color_reset()
|
|
|
|
if $TERM=="xterm-kitty" || $KITTY_LISTEN_ON != ""
|
|
|
|
if filereadable($HOME."/.dark")
|
|
|
|
let l:file = $HOME."/darkrc/kitty_dark.conf"
|
|
|
|
else
|
|
|
|
let l:file = $HOME."/darkrc/kitty_light.conf"
|
|
|
|
end
|
|
|
|
call system("kitty @ --to ".$KITTY_LISTEN_ON." set-colors ".l:file)
|
2020-08-19 16:41:42 +00:00
|
|
|
end
|
|
|
|
endfun
|
|
|
|
|
2024-02-28 22:21:58 +00:00
|
|
|
augroup termcolors
|
|
|
|
au VimLeavePre * call <SID>term_bg_color_reset()
|
|
|
|
augroup END
|