vis: fzf.sh allow multi select (puts to messages), skip register value if default register

This commit is contained in:
2025-09-25 23:47:51 +02:00
parent 26cbc9b667
commit 35046d1269
2 changed files with 12 additions and 3 deletions

View File

@@ -263,6 +263,7 @@ fi
exec fzf --query "$3" \
--prompt "$prompt" \
--header-label "$label" \
--multi \
--ansi \
--delimiter : \
--ghost ' (Use alt-? for help)' \

View File

@@ -93,13 +93,17 @@ end
local function fzf_sh(arg)
action = function(out)
open_file_pos(out, vis.win.file.modified and 'o' or 'e')
if (out:find('\n') or #out) == #out then
open_file_pos(out, vis.win.file.modified and 'o' or 'e')
else
vis:message(out)
end
end
local home = os.getenv('HOME')
local path = vis.win.file.path or ''
local dir = path:match('^.*/') or ''
local reg = ''
if reg ~= '"' then
if vis.register ~= '"' then
reg = string.gsub(vis.registers[vis.register][1], '%z', '')
end
local cmd = home ..
@@ -111,7 +115,11 @@ end
local function search(cmd, action)
if action == nil then
action = function(out)
open_file_pos(out, 'e')
if (out:find('\n') or #s) == #s then
open_file_pos(out, 'e')
else
vis:message(out)
end
end
end
if cmd:match('^fzf ') and vis.register ~= '"' then