From 1c14ee1623c48049055ed0771ef295af4491fa4f Mon Sep 17 00:00:00 2001 From: ADoyle Date: Sat, 30 Sep 2023 15:44:10 +0800 Subject: [PATCH] fix(neo-tree): For keymap "Y": use vim.ui.select instead of vim.fn.inputlist And popup the Copied window after selection --- lua/one/plugins/neo-tree.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lua/one/plugins/neo-tree.lua b/lua/one/plugins/neo-tree.lua index 25ffdc5..a68c172 100644 --- a/lua/one/plugins/neo-tree.lua +++ b/lua/one/plugins/neo-tree.lua @@ -28,21 +28,19 @@ local function keymapCopy(state) } -- absolute path to clipboard - local i = vim.fn.inputlist({ - 'Choose to copy to clipboard:', + vim.ui.select({ '1. Absolute path: ' .. results[1], '2. Path relative to CWD: ' .. results[2], '3. Path relative to HOME: ' .. results[3], '4. Filename: ' .. results[4], '5. Filename without extension: ' .. results[5], '6. Extension of the filename: ' .. results[6], - }) - - if i > 0 then + }, { prompt = 'Choose to copy to clipboard:' }, function(choice) + local i = tonumber(choice:sub(1, 1)) local result = results[i] - if not result then return print('Invalid choice: ' .. i) end vim.fn.setreg('"', result) - end + vim.notify('Copied: ' .. result) + end) end local moveToLastSibling = function(state)