2024-07-03 07:51:13 +02:00
|
|
|
local pick_chezmoi = function()
|
|
|
|
if LazyVim.pick.picker.name == "telescope" then
|
|
|
|
require("telescope").extensions.chezmoi.find_files()
|
|
|
|
elseif LazyVim.pick.picker.name == "fzf" then
|
|
|
|
local fzf_lua = require("fzf-lua")
|
|
|
|
local results = require("chezmoi.commands").list()
|
|
|
|
local chezmoi = require("chezmoi.commands")
|
|
|
|
|
|
|
|
local opts = {
|
|
|
|
fzf_opts = {},
|
|
|
|
fzf_colors = true,
|
|
|
|
actions = {
|
|
|
|
["default"] = function(selected)
|
|
|
|
chezmoi.edit({
|
|
|
|
targets = { "~/" .. selected[1] },
|
|
|
|
args = { "--watch" },
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
fzf_lua.fzf_exec(results, opts)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-06-29 09:21:35 +01:00
|
|
|
return {
|
|
|
|
{
|
|
|
|
-- highlighting for chezmoi files template files
|
|
|
|
"alker0/chezmoi.vim",
|
|
|
|
init = function()
|
|
|
|
vim.g["chezmoi#use_tmp_buffer"] = 1
|
|
|
|
vim.g["chezmoi#source_dir_path"] = os.getenv("HOME") .. "/.local/share/chezmoi"
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"xvzc/chezmoi.nvim",
|
|
|
|
keys = {
|
|
|
|
{
|
|
|
|
"<leader>sz",
|
2024-07-03 07:51:13 +02:00
|
|
|
pick_chezmoi,
|
2024-06-29 09:21:35 +01:00
|
|
|
desc = "Chezmoi",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
opts = {
|
|
|
|
edit = {
|
|
|
|
watch = false,
|
|
|
|
force = false,
|
|
|
|
},
|
|
|
|
notification = {
|
|
|
|
on_open = true,
|
|
|
|
on_apply = true,
|
|
|
|
on_watch = false,
|
|
|
|
},
|
|
|
|
telescope = {
|
|
|
|
select = { "<CR>" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
init = function()
|
|
|
|
-- run chezmoi edit on file enter
|
|
|
|
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
|
|
|
pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" },
|
|
|
|
callback = function()
|
|
|
|
vim.schedule(require("chezmoi.commands.__edit").watch)
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"nvimdev/dashboard-nvim",
|
|
|
|
optional = true,
|
|
|
|
opts = function(_, opts)
|
|
|
|
local projects = {
|
2024-07-03 07:51:13 +02:00
|
|
|
action = pick_chezmoi,
|
2024-06-29 09:21:35 +01:00
|
|
|
desc = " Config",
|
|
|
|
icon = "",
|
|
|
|
key = "c",
|
|
|
|
}
|
|
|
|
|
|
|
|
projects.desc = projects.desc .. string.rep(" ", 43 - #projects.desc)
|
|
|
|
projects.key_format = " %s"
|
|
|
|
|
|
|
|
-- remove lazyvim config property
|
|
|
|
for i = #opts.config.center, 1, -1 do
|
|
|
|
if opts.config.center[i].key == "c" then
|
|
|
|
table.remove(opts.config.center, i)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
table.insert(opts.config.center, 5, projects)
|
|
|
|
end,
|
|
|
|
},
|
2024-07-07 13:28:51 -04:00
|
|
|
|
|
|
|
-- Filetype icons
|
|
|
|
{
|
|
|
|
"echasnovski/mini.icons",
|
|
|
|
opts = {
|
|
|
|
file = {
|
|
|
|
[".chezmoiignore"] = { glyph = "", hl = "MiniIconsGrey" },
|
|
|
|
[".chezmoiremove"] = { glyph = "", hl = "MiniIconsGrey" },
|
|
|
|
[".chezmoiroot"] = { glyph = "", hl = "MiniIconsGrey" },
|
|
|
|
[".chezmoiversion"] = { glyph = "", hl = "MiniIconsGrey" },
|
|
|
|
["bash.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
|
|
|
|
["json.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
|
|
|
|
["ps1.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
|
|
|
|
["sh.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
|
|
|
|
["toml.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
|
|
|
|
["yaml.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
|
|
|
|
["zsh.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-06-29 09:21:35 +01:00
|
|
|
}
|