feat(multicursor): "]C"/"[C" leave a cursor at old position #41681

Problem:
`]C` jumps the primary onto another cursor, which dedupes at the next
edit. Every `]C` consumes a cursor.

Solution:
`]C` adds a cursor at the current position before jumping. This
effectively "rotates" the primary cursor.
This commit is contained in:
Justin M. Keyes
2026-09-04 06:28:42 -04:00
committed by GitHub
parent 8c77b5be94
commit 2124f968a6
3 changed files with 16 additions and 6 deletions

View File

@@ -164,6 +164,8 @@ function M.jump(forward, count)
idx = (i - 1 - steps) % n + 1
end
vim.cmd [[normal! m']]
-- Leave a cursor behind: the jump rotates which cursor is primary, the set of positions stays.
vim.api.nvim_mcursor(0, curpos:to_cursor())
vim.api.nvim_win_set_cursor(0, positions[idx]:to_cursor())
return true
end