Compare commits

..

2 commits

Author SHA1 Message Date
6720827d61
Add wezvar nvim module 2024-08-05 08:21:16 +02:00
06caadc9e6
Remove old code from colors.vim
This is now all in colors.lua
2024-08-05 08:20:13 +02:00
2 changed files with 7 additions and 41 deletions

7
vim/lua/wezvar.lua Normal file
View file

@ -0,0 +1,7 @@
return function(variable, value)
vim.fn.chansend(vim.v.stderr, string.format(
"\x1b]1337;SetUserVar=%s=%s\x07\n",
variable,
vim.base64.encode(value)
))
end

View file

@ -1,11 +1,5 @@
let g:only_generic_hl=1
function! s:wez_color(value)
let g:__color = a:value
lua vim.g.__color = vim.base64.encode(vim.g.__color)
call chansend(v:stderr, "\x1b]1337;SetUserVar=bgcolor=".g:__color."\x07")
endfun
function! s:term_bg_color()
let l:num_color=synIDattr(hlID("normal"), "bg")
if $TERM=="xterm-kitty" || $KITTY_LISTEN_ON != ""
@ -19,8 +13,6 @@ function! s:term_bg_color()
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")
end
elseif $TERM_PROGRAM=="WezTerm"
call <SID>wez_color(l:num_color)
end
endfun
@ -36,42 +28,9 @@ function! s:term_bg_color_reset()
let l:file = $HOME."/darkrc/kitty_light.conf"
end
call system("kitty @ --to ".$KITTY_LISTEN_ON." set-colors ".l:file)
elseif $TERM_PROGRAM=="WezTerm"
end
endfun
augroup termcolors
au VimLeavePre * call <SID>term_bg_color_reset()
augroup END
com! Dark silent! let g:colors_name_bak = g:colors_name
\ | let g:ayucolor="dark"
\ | let g:arcadia_Daybreak=0
\ | let g:arcadia_Midnight=1
\ | let g:alduin_Shout_Become_Ethereal=1
\ | set bg=dark
\ | silent! exec "colorscheme ".g:colors_name_bak
\ | silent! delc PaperColor
com! Light silent! let g:colors_name_bak = g:colors_name
\ | let g:ayucolor="light"
\ | let g:arcadia_Daybreak=1
\ | let g:arcadia_Midnight=0
\ | let g:alduin_Shout_Become_Ethereal=0
\ | set bg=light
\ | silent! exec "colorscheme ".g:colors_name_bak
\ | silent! delc PaperColor
if filereadable($HOME."/.dark")
Dark
else
Light
end
if $TERM=="xterm-kitty" || match($TERM, '-256color$')
set termguicolors
if &bg=="dark"
colorscheme sierra
else
colorscheme PaperColor
end
end