1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:30:04 +08:00

perf(neoyank): handle errors

This commit is contained in:
wsdjeg 2022-10-27 22:01:21 +08:00
parent 56a1ab4796
commit 4399354a8f

View File

@ -52,7 +52,12 @@ local function show_yank_history(opts)
actions.close(prompt_bufnr) actions.close(prompt_bufnr)
local reg = vim.fn.getreg('"') local reg = vim.fn.getreg('"')
vim.fn.setreg('"', entry.value[1]) vim.fn.setreg('"', entry.value[1])
vim.cmd("normal! p") local ok, rst = pcall(vim.cmd, 'normal! p')
if not ok then
vim.g._spacevim_temp_err = rst
-- @todo implement lua notify api
local notify = vim.api.nvim_eval('SpaceVim#api#notify#get().notify(g:_spacevim_temp_err, "WarningMsg")')
end
vim.fn.setreg('"', reg) vim.fn.setreg('"', reg)
end) end)
return true return true