diff --git a/lua/plugins.lua b/lua/plugins.lua index 01e376a..7091e4c 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -36,6 +36,17 @@ vim.pack.add({ pcall(vim.cmd.colorscheme, "gruvbox") +-- Light/dark follows the terminal (Ghostty: `theme = light:...,dark:...`). +-- Nvim asks the terminal for its background at startup and again whenever the +-- terminal reports a theme change (DEC mode 2031: Ghostty does, tmux >= 3.6 +-- passes it on), then sets 'background', which reloads gruvbox and everything +-- keyed off ColorScheme. That only works while 'background' is never set by +-- hand, so don't. Fallback for terminals that don't report changes: ask again +-- whenever nvim gets focus back. +vim.api.nvim_create_autocmd("FocusGained", { + callback = function() vim.api.nvim_ui_send("\027]11;?\007") end, +}) + -- Simple setup({}) plugins for _, name in ipairs({ "mini.pick", "mini.extra", "mini.icons", "mason", "typst-preview", @@ -273,7 +284,9 @@ vim.api.nvim_create_autocmd("FileType", { end, }) -require("lualine").setup({ options = { theme = "gruvbox_dark" } }) +-- "gruvbox" picks gruvbox_light or gruvbox_dark from 'background', and lualine +-- reloads it when that changes. +require("lualine").setup({ options = { theme = "gruvbox" } }) -- Treesitter (main branch: no configs.setup; install parsers manually) require("nvim-treesitter").install({