mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
fix(picker.actions): use vim.v.register
instead of +
as default.
This commit is contained in:
parent
6f88b1ced9
commit
9ab6637df0
2 changed files with 6 additions and 4 deletions
|
@ -86,7 +86,7 @@ function M.actions.explorer_yank(_, item)
|
|||
if not item then
|
||||
return
|
||||
end
|
||||
vim.fn.setreg("+", item.file)
|
||||
vim.fn.setreg(vim.v.register or "+", item.file)
|
||||
Snacks.notify.info("Yanked `" .. item.file .. "`")
|
||||
end
|
||||
|
||||
|
|
|
@ -432,7 +432,7 @@ end
|
|||
function M.yank(picker, item, action)
|
||||
---@cast action snacks.picker.yank.Action
|
||||
if item then
|
||||
local reg = action.reg or "+"
|
||||
local reg = action.reg or vim.v.register
|
||||
local value = item[action.field] or item.data or item.text
|
||||
vim.fn.setreg(reg, value)
|
||||
local buf = item.buf or vim.api.nvim_win_get_buf(picker.main)
|
||||
|
@ -442,10 +442,12 @@ function M.yank(picker, item, action)
|
|||
end
|
||||
M.copy = M.yank
|
||||
|
||||
function M.put(picker, item)
|
||||
function M.put(picker, item, action)
|
||||
---@cast action snacks.picker.yank.Action
|
||||
picker:close()
|
||||
if item then
|
||||
vim.api.nvim_put({ item.data or item.text }, "c", true, true)
|
||||
local value = item[action.field] or item.data or item.text
|
||||
vim.api.nvim_put({ value }, "", true, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue