vis: fzf.sh allow multi select (puts to messages), skip register value if default register
This commit is contained in:
@@ -263,6 +263,7 @@ fi
|
|||||||
exec fzf --query "$3" \
|
exec fzf --query "$3" \
|
||||||
--prompt "$prompt" \
|
--prompt "$prompt" \
|
||||||
--header-label "$label" \
|
--header-label "$label" \
|
||||||
|
--multi \
|
||||||
--ansi \
|
--ansi \
|
||||||
--delimiter : \
|
--delimiter : \
|
||||||
--ghost ' (Use alt-? for help)' \
|
--ghost ' (Use alt-? for help)' \
|
||||||
|
|||||||
@@ -93,13 +93,17 @@ end
|
|||||||
|
|
||||||
local function fzf_sh(arg)
|
local function fzf_sh(arg)
|
||||||
action = function(out)
|
action = function(out)
|
||||||
|
if (out:find('\n') or #out) == #out then
|
||||||
open_file_pos(out, vis.win.file.modified and 'o' or 'e')
|
open_file_pos(out, vis.win.file.modified and 'o' or 'e')
|
||||||
|
else
|
||||||
|
vis:message(out)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local home = os.getenv('HOME')
|
local home = os.getenv('HOME')
|
||||||
local path = vis.win.file.path or ''
|
local path = vis.win.file.path or ''
|
||||||
local dir = path:match('^.*/') or ''
|
local dir = path:match('^.*/') or ''
|
||||||
local reg = ''
|
local reg = ''
|
||||||
if reg ~= '"' then
|
if vis.register ~= '"' then
|
||||||
reg = string.gsub(vis.registers[vis.register][1], '%z', '')
|
reg = string.gsub(vis.registers[vis.register][1], '%z', '')
|
||||||
end
|
end
|
||||||
local cmd = home ..
|
local cmd = home ..
|
||||||
@@ -111,7 +115,11 @@ end
|
|||||||
local function search(cmd, action)
|
local function search(cmd, action)
|
||||||
if action == nil then
|
if action == nil then
|
||||||
action = function(out)
|
action = function(out)
|
||||||
|
if (out:find('\n') or #s) == #s then
|
||||||
open_file_pos(out, 'e')
|
open_file_pos(out, 'e')
|
||||||
|
else
|
||||||
|
vis:message(out)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if cmd:match('^fzf ') and vis.register ~= '"' then
|
if cmd:match('^fzf ') and vis.register ~= '"' then
|
||||||
|
|||||||
Reference in New Issue
Block a user