wishlist icon indicating copy to clipboard operation
wishlist copied to clipboard

Multiple cursors

Open NNBnh opened this issue 2 years ago • 0 comments

What? Similar to Vim-visual-multi but have more action/feature from Kakoune, Helix and Pepper.

Specifically we don't need the plugins to add any key mappings (explanation), just add the following actions so user could map it themself however they desire:

From Kakoune's keys docs:

Kakoune bindings Action's description
N Add a new selection with next match after the main selection.
<a-N> Add a new selection with previous match before the main selection.
C Copy the main selection to the next line.
<a-C> Copy the main selection to the previous line.
s Create a selection for each match of the given regex.
S Split selections with the given regex.
<a-s> Split selections on line boundaries.
<space> Clear selections to only keep the main one.
<a-space> Clear the main selection.
<a-k> Keep selections that match the given regex.
<a-K> Clear selections that match the given regex.
) Rotate main selection (the main selection becomes the next one).
( Rotate main selection backward (the main selection becomes the previous one).
& Align selections, align the cursor of each selection by inserting spaces before the first character of each selection.
Z Save selections to the register.
z Restore selections from the register.
<a-z>a Append selections from the register with the current ones.
<a-z>u Keep a union of selections from the register with the current ones.
<a-z>i Keep an intersection of selections from the register with the current ones.
<a-Z>a Append current selections with the ones in the register.
<a-Z>u Keep a union of selections from the current selections with the ones in the register.
<a-Z>i Keep an intersection of selections from the current selections with the ones in the register.

NOTE: The "Save/restore selections to the register" actions is not the same as Vim's built-in mark because it can save all cursor's position and selection (if in visual mode), then user can not only just go to that marker but also restore all of that cursor's position and selection (re-enter visual mode if needed).

Why? I know that Vim doesn't need multiple cursors but I just really like the multiple cursors workflow in Kakoune and Pepper but miss the Neovim ecosystem.

Potential existing implementations: In Vimscript: Vim-visual-multi

NNBnh avatar Feb 26 '22 05:02 NNBnh