From 63feeb9f369fc6176e85c1c2d8fcc863caad1946 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Tue, 10 Feb 2026 12:32:48 +0100 Subject: start new MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- .vim/plugin/darkmode.lua | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 .vim/plugin/darkmode.lua (limited to '.vim/plugin/darkmode.lua') diff --git a/.vim/plugin/darkmode.lua b/.vim/plugin/darkmode.lua deleted file mode 100644 index 6ffd06f..0000000 --- a/.vim/plugin/darkmode.lua +++ /dev/null @@ -1,47 +0,0 @@ --- this plugin registers registers and autocommand that switches colorschemes on UIEnter based on --- the system's preference for dark/light mode - -local state = { enabled = true } - -if not state.enabled then - return -end - -local set_darkmode = function(enabled) - if enabled then - vim.opt.background = 'dark' - vim.cmd.colorscheme(vim.g.darkmode_colorscheme_dark or 'default') - else - vim.opt.background = 'light' - vim.cmd.colorscheme(vim.g.darkmode_colorscheme_light or 'default') - end -end - --- returns if system is configured to use darkmode -local discover = function() - require('plenary.job') - :new({ - command = 'porta', - args = { 'settings', 'org.freedesktop.appearance', 'color-scheme' }, - enable_recording = true, - on_exit = vim.schedule_wrap(function(job, exitcode) - local darkmode_enabled = true - local res = job:result() - if exitcode == 0 and #res then - darkmode_enabled = not (res[1] == 'prefer-light') - end - set_darkmode(darkmode_enabled) - end), - }) - :start() -end - --- setup autogroup -local aug = vim.api.nvim_create_augroup('darkmode', { clear = true }) - --- setup color-scheme detection via desktop portal apis -vim.api.nvim_create_autocmd({ 'UIEnter', 'VimResume' }, { callback = discover, group = aug }) -vim.api.nvim_create_autocmd({ 'Signal' }, { pattern = 'SIGUSR1', callback = discover, group = aug }) - --- fix ColorColumn not being defined -vim.api.nvim_set_hl(0, 'ColorColumn', { link = 'CursorColumn', force = true }) -- cgit 1.4.1