mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
fix(fzf): decouple defaults from opts to easy switch profiles
This commit is contained in:
parent
cb40a09538
commit
d97100c8cc
1 changed files with 22 additions and 14 deletions
|
|
@ -74,18 +74,6 @@ return {
|
|||
config.defaults.actions.files["alt-c"] = config.defaults.actions.files["ctrl-r"]
|
||||
config.set_action_helpstr(config.defaults.actions.files["ctrl-r"], "toggle-root-dir")
|
||||
|
||||
-- use the same prompt for all
|
||||
local defaults = require("fzf-lua.profiles.default-title")
|
||||
local function fix(t)
|
||||
t.prompt = t.prompt ~= nil and " " or nil
|
||||
for _, v in pairs(t) do
|
||||
if type(v) == "table" then
|
||||
fix(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
fix(defaults)
|
||||
|
||||
local img_previewer ---@type string[]?
|
||||
for _, v in ipairs({
|
||||
{ cmd = "ueberzug", args = {} },
|
||||
|
|
@ -98,7 +86,8 @@ return {
|
|||
end
|
||||
end
|
||||
|
||||
return vim.tbl_deep_extend("force", defaults, {
|
||||
return {
|
||||
"default-title",
|
||||
fzf_colors = true,
|
||||
fzf_opts = {
|
||||
["--no-scrollbar"] = true,
|
||||
|
|
@ -186,9 +175,28 @@ return {
|
|||
previewer = vim.fn.executable("delta") == 1 and "codeaction_native" or nil,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
local defaults
|
||||
|
||||
if opts[1] == "default-title" then
|
||||
-- use the same prompt for all pickers for profile `default-title` and
|
||||
-- profiles that use `default-title` as base profile
|
||||
defaults = require("fzf-lua.profiles.default-title")
|
||||
local function fix(t)
|
||||
t.prompt = t.prompt ~= nil and " " or nil
|
||||
for _, v in pairs(t) do
|
||||
if type(v) == "table" then
|
||||
fix(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
fix(defaults)
|
||||
end
|
||||
|
||||
opts = vim.tbl_deep_extend("force", defaults or {}, opts)
|
||||
|
||||
require("fzf-lua").setup(opts)
|
||||
end,
|
||||
init = function()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue