Open arnevm123 opened 2 months ago
Update:
This is a better workaround:
vim.api.nvim_create_autocmd("FocusLost", {
group = vim.api.nvim_create_augroup("NeoClipFocusLost", {}),
pattern = "*",
callback = function()
require("neoclip").db_push()
end,
})
vim.api.nvim_create_autocmd("FocusGained", {
group = vim.api.nvim_create_augroup("NeoClipFocusGained", {}),
pattern = "*",
callback = function()
require("nio").run(function()
require("nio").sleep(200)
require("neoclip").db_pull()
end)
end,
})
Hi @arnevm123, this is really great! I have been meaning to reply to this but haven't had time yet
When trying to execute a
:g
(:global
) command with continuous_sync enabled this makes the command noticeable slower.How to reproduce this: Enable continuous_sync, open a random file and try a global command. Example of this would be
:g/^$/d
to remove all empty lines in a file (a file with 20-30 empty lines already has a noticeable delay on my machine). Toggle the continuous sync on and off to see the difference in speed.Minimal config to test this:
Not sure if this would be an easy fix, but I have a workaround: Only push the database on focus lost:
FocusGained does not work when using autoread, so I sync whenever I trigger the telescope menu: