mirror of
https://github.com/neovim/neovim.git
synced 2026-09-09 07:25:51 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user