Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(special-put): make ring works with special paste #45

Merged
merged 1 commit into from
Aug 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lua/yanky.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function yanky.init_ring(type, register, count, is_visual, callback)
register = register,
count = count > 0 and count or 1,
is_visual = is_visual,
use_repeat = callback == nil,
}

if nil ~= callback then
Expand Down Expand Up @@ -191,12 +192,12 @@ function yanky.cycle(direction)
end

utils.use_temporary_register(yanky.ring.state.register, next_content, function()
if new_state.is_visual then -- Can't manage to make visual replacement repeatable
vim.cmd("silent normal! u")
yanky.ring.callback(new_state, do_put)
else
if new_state.use_repeat then
vim.cmd("silent normal! u.")
highlight.highlight_put(new_state)
else
vim.cmd("silent normal! u")
yanky.ring.callback(new_state, do_put)
end
end)

Expand Down