feat(file_selector_fzf): Add multi select for fzf-lua file selector (#1047)
This commit is contained in:
parent
c8ba3d36cc
commit
6ebba1526b
@ -142,8 +142,14 @@ function FileSelector:fzf_ui(handler)
|
|||||||
git_icons = false,
|
git_icons = false,
|
||||||
actions = {
|
actions = {
|
||||||
["default"] = function(selected)
|
["default"] = function(selected)
|
||||||
local file = fzf_lua.path.entry_to_file(selected[1])
|
if not selected or #selected == 0 then return close_action() end
|
||||||
handler(file.path)
|
local selections = {}
|
||||||
|
for _, entry in ipairs(selected) do
|
||||||
|
local file = fzf_lua.path.entry_to_file(entry)
|
||||||
|
if file and file.path then table.insert(selections, file.path) end
|
||||||
|
end
|
||||||
|
|
||||||
|
if #selections > 0 then handler(#selections == 1 and selections[1] or selections) end
|
||||||
end,
|
end,
|
||||||
["esc"] = close_action,
|
["esc"] = close_action,
|
||||||
["ctrl-c"] = close_action,
|
["ctrl-c"] = close_action,
|
||||||
@ -200,7 +206,6 @@ function FileSelector:telescope_ui(handler)
|
|||||||
:find()
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type FileSelectorHandler
|
|
||||||
function FileSelector:native_ui(handler)
|
function FileSelector:native_ui(handler)
|
||||||
local filepaths = vim
|
local filepaths = vim
|
||||||
.iter(self.file_cache)
|
.iter(self.file_cache)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user