diff options
| author | Robert Günzler <r@gnzler.io> | 2024-11-25 13:30:37 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2024-11-25 13:58:25 +0100 |
| commit | 23de12baba9fbfc4ca24581b37c374aa5345cc25 (patch) | |
| tree | e4b3c421bad572eb85a1089eaad44dc3059ab6e6 /.vim/plugin/colorscheme.lua | |
| parent | 18e3848110da0a59843058927ea04b496f5db2a5 (diff) | |
update nvim config
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '.vim/plugin/colorscheme.lua')
| -rw-r--r-- | .vim/plugin/colorscheme.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/.vim/plugin/colorscheme.lua b/.vim/plugin/colorscheme.lua new file mode 100644 index 0000000..240737e --- /dev/null +++ b/.vim/plugin/colorscheme.lua @@ -0,0 +1,23 @@ +vim.opt.background = 'dark' + +-- setup color-scheme detection via desktop portal apis +vim.api.nvim_create_autocmd('UIEnter', { + once = true, + callback = function() + local job = require('plenary.job'):new({ + command = 'porta', + args = { 'settings', 'org.freedesktop.appearance', 'color-scheme' }, + enable_recording = true, + }) + local res, exitcode = job:sync() + if exitcode == 0 and #res == 1 then + if res[1] == 'prefer-light' then + vim.opt.background = 'light' + else + vim.opt.background = 'dark' + end + end + end, +}) + +vim.api.nvim_set_hl(0, 'ColorColumn', { link = 'CursorColumn', force = true }) |