1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-13 01:02:18 -04:00

Neovim template enhancements (#2078)

* feat: add neovim-lualine template, set vim.o.background automatically based on dms light/dark mode

* feat(matugen): add option to follow dms background color or not on neovim

* chore: regenerate settings and translation index after merging master
This commit is contained in:
Jonas Bloch
2026-03-25 14:16:01 +01:00
committed by GitHub
parent 906c6a2501
commit 516c478f3d
9 changed files with 270 additions and 203 deletions

View File

@@ -1,3 +1,7 @@
[templates.dmsneovim]
input_path = 'SHELL_DIR/matugen/templates/neovim.lua'
[templates.dmsneovim-colors]
input_path = 'SHELL_DIR/matugen/templates/neovim-colors.lua'
output_path = 'CONFIG_DIR/nvim/colors/dms.lua'
[templates.dmsneovim-lualine]
input_path = 'SHELL_DIR/matugen/templates/neovim-lualine.lua'
output_path = 'CONFIG_DIR/nvim/lua/lualine/themes/dms.lua'

View File

@@ -35,6 +35,15 @@ local function deepGet(t, k)
return t
end
local mode = vim.system({ "dms", "ipc", "call", "theme", "getMode" }, { text = true }):wait().stdout
if mode ~= nil then
if mode:match("light") then
vim.o.background = "light"
elseif mode:match("dark") then
vim.o.background = "dark"
end
end
local current_file_path = debug.getinfo(1, "S").source:sub(2)
local theme_base = deepGet(settings, { "matugenTemplateNeovimSettings", vim.o.background, "baseTheme" })
or ("github_" .. vim.o.background)
@@ -74,7 +83,9 @@ end
if not base46.theme_tables[theme_name] or base46.theme_tables[theme_name].type ~= vim.o.background then
local builtin = vim.deepcopy(assert(base46.get_builtin_theme(theme_base)))
local harmonized = base46.theme_harmonize(builtin, "{{colors.source_color.default.hex}}", harmony)
harmonized = base46.theme_set_bg(harmonized, "{{colors.background.default.hex}}")
if settings.matugenTemplateNeovimSetBackground ~= false then
harmonized = base46.theme_set_bg(harmonized, "{{colors.background.default.hex}}")
end
base46.theme_tables[theme_name] = harmonized
end

View File

@@ -0,0 +1,3 @@
-- NOTE: this file should never be accessed if AvengeMedia/base46 is not installed,
-- the neovim-colors.lua template will fail first.
return require("lualine.themes._base46")("dms")