Skip to content

Commit

Permalink
fix(neo-tree): When press "Y", user can choose copy to nvim or system…
Browse files Browse the repository at this point in the history
… clipboard

and fix error when Ctrl-c pressed with selection
  • Loading branch information
adoyle-h committed May 20, 2024
1 parent bc24d43 commit d2ff1eb
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lua/one/plugins/neo-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,22 @@ local function keymapCopy(state)
'5. Filename without extension: ' .. results[5],
'6. Extension of the filename: ' .. results[6],
}, { prompt = 'Choose to copy to clipboard:' }, function(choice)
if not choice then return end
local i = tonumber(choice:sub(1, 1))
local result = results[i]
vim.fn.setreg('"', result)
vim.notify('Copied: ' .. result)

vim.ui.select({
'Copy to nvim clipboard',
'Copy to system clipboard',
}, { prompt = 'Copy to' }, function(r)
if not r then return end
if r == 'Copy to nvim clipboard' then
vim.fn.setreg('"', result)
else
vim.fn.setreg('+', result)
end
vim.notify('Copied: ' .. result)
end)
end)
end

Expand Down

0 comments on commit d2ff1eb

Please sign in to comment.