Skip to content

Commit

Permalink
perf(remote): restore views on TextYankPost
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 24, 2023
1 parent 587a243 commit d4dadc8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/flash/plugins/remote.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,20 @@ function M.restore()
vim.api.nvim_set_current_win(M.win)
vim.fn.winrestview(M.view)
end
restore = vim.schedule_wrap(restore)

if M.operator == "c" then
vim.api.nvim_create_autocmd("InsertLeave", {
once = true,
callback = restore,
})
elseif M.operator == "y" then -- need to check for some opt to paste after yank
vim.api.nvim_create_autocmd("TextYankPost", {
once = true,
callback = restore,
})
else
vim.schedule(restore)
restore()
end
end

Expand Down

0 comments on commit d4dadc8

Please sign in to comment.