mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
Update fzf-lua pick_chezmoi to use files picker and chezmoiedit command
- Use `fzf-lua`'s `files` picker to have icons and preview - Use `vimcd_entry()` to parse picker output
This commit is contained in:
parent
1e83b4f843
commit
692bd4a00e
1 changed files with 5 additions and 15 deletions
|
|
@ -3,22 +3,12 @@ local pick_chezmoi = function()
|
|||
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,
|
||||
},
|
||||
local actions = {
|
||||
["enter"] = function(selected)
|
||||
fzf_lua.actions.vimcmd_entry("ChezmoiEdit", selected, {cwd = os.getenv("HOME")})
|
||||
end,
|
||||
}
|
||||
fzf_lua.fzf_exec(results, opts)
|
||||
require("fzf-lua").files({ cmd = "chezmoi managed --include=files,symlinks", actions = actions })
|
||||
elseif LazyVim.pick.picker.name == "snacks" then
|
||||
local results = require("chezmoi.commands").list({
|
||||
args = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue