perf(yanky): schedule_wrap sqlite push to history to prevent blocking Neovim on copy/paste

This commit is contained in:
Folke Lemaitre
2024-05-15 08:48:55 +02:00
parent 3c04789ef1
commit 9047d041a8

View File

@ -4,7 +4,7 @@ return {
"gbprod/yanky.nvim",
dependencies = not LazyVim.is_win() and { "kkharji/sqlite.lua" } or {},
opts = {
highlight = { timer = 250 },
highlight = { timer = 150 },
ring = { storage = LazyVim.is_win() and "shada" or "sqlite" },
},
keys = {
@ -28,5 +28,11 @@ return {
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put After Applying a Filter" },
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put Before Applying a Filter" },
},
config = function(_, opts)
require("yanky").setup(opts)
local sqlite = require("yanky.storage.sqlite")
local push = sqlite.push
sqlite.push = vim.schedule_wrap(push)
end,
},
}