mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat(lazygit): allow user to override LazyVim config with custom file
This commit is contained in:
parent
12818a6cb4
commit
c5924d2e29
2 changed files with 10 additions and 3 deletions
|
|
@ -20,9 +20,12 @@ vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" }
|
||||||
|
|
||||||
-- LazyVim automatically configures lazygit:
|
-- LazyVim automatically configures lazygit:
|
||||||
-- * theme, based on the active colorscheme.
|
-- * theme, based on the active colorscheme.
|
||||||
-- * editorPreset to nvim-remote
|
-- * editPreset to nvim-remote
|
||||||
-- * enables nerd font icons
|
-- * enables nerd font icons
|
||||||
-- Set to false to disable.
|
-- Set to false to disable.
|
||||||
|
-- Set the options you want to override in `~/.config/lazygit/custom.yml`
|
||||||
|
-- WARN: on Windows you might want to set `editPreset: "nvim"` due to
|
||||||
|
-- this issue https://github.com/jesseduffield/lazygit/issues/3467
|
||||||
vim.g.lazygit_config = true
|
vim.g.lazygit_config = true
|
||||||
|
|
||||||
-- Options for the LazyVim statuscolumn
|
-- Options for the LazyVim statuscolumn
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,10 @@ function M.open(opts)
|
||||||
if ok then
|
if ok then
|
||||||
M.config_dir = lines[1]
|
M.config_dir = lines[1]
|
||||||
vim.env.LG_CONFIG_FILE = LazyVim.norm(M.config_dir .. "/config.yml" .. "," .. M.theme_path)
|
vim.env.LG_CONFIG_FILE = LazyVim.norm(M.config_dir .. "/config.yml" .. "," .. M.theme_path)
|
||||||
|
local custom_config = LazyVim.norm(M.config_dir .. "/custom.yml")
|
||||||
|
if vim.uv.fs_stat(custom_config) and vim.uv.fs_stat(custom_config).type == "file" then
|
||||||
|
vim.env.LG_CONFIG_FILE = vim.env.LG_CONFIG_FILE .. "," .. custom_config
|
||||||
|
end
|
||||||
else
|
else
|
||||||
---@diagnostic disable-next-line: cast-type-mismatch
|
---@diagnostic disable-next-line: cast-type-mismatch
|
||||||
---@cast lines string
|
---@cast lines string
|
||||||
|
|
@ -130,9 +134,9 @@ gui:
|
||||||
---@type string[]
|
---@type string[]
|
||||||
local lines = {}
|
local lines = {}
|
||||||
for k, v in pairs(theme) do
|
for k, v in pairs(theme) do
|
||||||
lines[#lines + 1] = (" %s:"):format(k)
|
lines[#lines + 1] = (" %s:"):format(k)
|
||||||
for _, c in ipairs(v) do
|
for _, c in ipairs(v) do
|
||||||
lines[#lines + 1] = (" - %q"):format(c)
|
lines[#lines + 1] = (" - %q"):format(c)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
config = config .. table.concat(lines, "\n")
|
config = config .. table.concat(lines, "\n")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue