aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-01-04 21:10:51 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2023-01-04 21:17:53 +0100
commit6211fa0766f8227a819df2248c8db25d5c58c01f (patch)
treed3bccfd09fbbb75b9dd865d435c1bbb51e0dd3b0
parent53cebbabeb224a0370848ee71eff80b9e6b67671 (diff)
downloadvis-lspc-6211fa0766f8227a819df2248c8db25d5c58c01f.tar.gz
vis-lspc-6211fa0766f8227a819df2248c8db25d5c58c01f.zip
allow cursor keys when using vis-menu
vis uses vis:pipe to call vis-menu when completing filenames. Simply copy what vis does. However, using vis:pipe does not work with fzf. I do not understand why but the vis-menu special case seams to work.
-rw-r--r--init.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index dd55949..893f004 100644
--- a/init.lua
+++ b/init.lua
@@ -367,11 +367,19 @@ local function lspc_select(choices)
return choices[1]
end
+ local status, output
local cmd = 'printf "' .. menu_input .. '" | ' .. lspc.menu_cmd
lspc.log('collect choice using: ' .. cmd)
- local menu = io.popen(cmd)
- local output = menu:read('*a')
- local _, _, status = menu:close()
+
+ if lspc.menu_cmd == 'vis-menu' then
+ status, output = vis:pipe(vis.win.file, {start = 0, finish = 0}, cmd)
+ else
+ local menu = io.popen(cmd)
+ output = menu:read('*a')
+ local _, _, _status = menu:close()
+ status = _status
+
+ end
local choice = nil
if status == 0 then