From 6211fa0766f8227a819df2248c8db25d5c58c01f Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 4 Jan 2023 21:10:51 +0100 Subject: 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. --- init.lua | 14 +++++++++++--- 1 file 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 -- cgit v1.2.3