mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 05:51:06 +00:00
Merge 3e997661b8 into 459a4c3b10
This commit is contained in:
commit
8144b4611a
1 changed files with 16 additions and 54 deletions
|
|
@ -1,54 +1,3 @@
|
||||||
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 actions = {
|
|
||||||
["enter"] = function(selected)
|
|
||||||
fzf_lua.actions.vimcmd_entry("ChezmoiEdit", selected, { cwd = vim.env.HOME })
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
fzf_lua.files({
|
|
||||||
cmd = "chezmoi managed --include=files,symlinks",
|
|
||||||
actions = actions,
|
|
||||||
cwd = vim.env.HOME,
|
|
||||||
hidden = false,
|
|
||||||
})
|
|
||||||
elseif LazyVim.pick.picker.name == "snacks" then
|
|
||||||
local results = require("chezmoi.commands").list({
|
|
||||||
args = {
|
|
||||||
"--path-style",
|
|
||||||
"absolute",
|
|
||||||
"--include",
|
|
||||||
"files",
|
|
||||||
"--exclude",
|
|
||||||
"externals",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
local items = {}
|
|
||||||
|
|
||||||
for _, czFile in ipairs(results) do
|
|
||||||
table.insert(items, {
|
|
||||||
text = czFile,
|
|
||||||
file = czFile,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
---@type snacks.picker.Config
|
|
||||||
local opts = {
|
|
||||||
items = items,
|
|
||||||
confirm = function(picker, item)
|
|
||||||
picker:close()
|
|
||||||
require("chezmoi.commands").edit({
|
|
||||||
targets = { item.text },
|
|
||||||
args = { "--watch" },
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
Snacks.picker.pick(opts)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
-- highlighting for chezmoi files template files
|
-- highlighting for chezmoi files template files
|
||||||
|
|
@ -64,7 +13,16 @@ return {
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
"<leader>sz",
|
"<leader>sz",
|
||||||
pick_chezmoi,
|
function()
|
||||||
|
require("chezmoi.pick")[LazyVim.pick.picker.name]()
|
||||||
|
end,
|
||||||
|
desc = "Chezmoi",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>sZ",
|
||||||
|
function()
|
||||||
|
require("chezmoi.pick")[LazyVim.pick.picker.name](vim.fn.stdpath("config"))
|
||||||
|
end,
|
||||||
desc = "Chezmoi",
|
desc = "Chezmoi",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -97,7 +55,9 @@ return {
|
||||||
optional = true,
|
optional = true,
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local projects = {
|
local projects = {
|
||||||
action = pick_chezmoi,
|
action = function()
|
||||||
|
require("chezmoi.pick")[LazyVim.pick.picker.name]()
|
||||||
|
end,
|
||||||
desc = " Config",
|
desc = " Config",
|
||||||
icon = "",
|
icon = "",
|
||||||
key = "c",
|
key = "c",
|
||||||
|
|
@ -124,7 +84,9 @@ return {
|
||||||
icon = " ",
|
icon = " ",
|
||||||
key = "c",
|
key = "c",
|
||||||
desc = "Config",
|
desc = "Config",
|
||||||
action = pick_chezmoi,
|
action = function()
|
||||||
|
require("chezmoi.pick")[LazyVim.pick.picker.name]()
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
local config_index
|
local config_index
|
||||||
for i = #opts.dashboard.preset.keys, 1, -1 do
|
for i = #opts.dashboard.preset.keys, 1, -1 do
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue