fix(fzf): use custom formatter for now, since filename_search messes with searching

This commit is contained in:
Folke Lemaitre 2024-06-12 16:41:01 +02:00
parent b2b6ff0738
commit ff223e7347

View file

@ -82,7 +82,8 @@ return {
["--no-scrollbar"] = true, ["--no-scrollbar"] = true,
}, },
defaults = { defaults = {
formatter = "path.filename_first", -- formatter = "path.filename_first",
formatter = "path.hl",
}, },
-- Custom LazyVim option to configure vim.ui.select -- Custom LazyVim option to configure vim.ui.select
ui_select = function(fzf_opts, items) ui_select = function(fzf_opts, items)
@ -101,6 +102,38 @@ return {
}, },
}) })
end, end,
formatters = {
path = {
hl = {
_to = function()
local utils = require("fzf-lua.utils")
local _, hl_file = utils.ansi_from_hl("FzfLuaFilePart", "foo")
local _, hl_dir = utils.ansi_from_hl("FzfLuaDirPart", "foo")
return ([[
return function(s, _, m)
local _path, _utils = m.path, m.utils
local _hl_dir = "%s"
local _hl_file = "%s"
local parent = _path.parent(s)
local tail = _path.tail(s)
if #_hl_file > 0 then
tail = _hl_file .. tail .. _utils.ansi_escseq.clear
end
if parent then
parent = _path.remove_trailing(parent) .. "/"
if #_hl_dir > 0 then
parent = _hl_dir .. parent .. _utils.ansi_escseq.clear
end
else
parent = ""
end
return parent .. tail
end
]]):format(hl_dir, hl_file)
end,
},
},
},
winopts = { winopts = {
width = 0.8, width = 0.8,
height = 0.8, height = 0.8,