vamolessa / pepper

simple and opinionated modal code editor for your terminal
https://vamolessa.github.io/pepper/
372 stars 17 forks source link

Add align selections #56

Open NNBnh opened 2 years ago

NNBnh commented 2 years ago

Align selections is a crucial and very frequently use action (example) that I really miss when switch to Pepper. From Kakoune's keys docs:

& : Align selections, align the cursor of each selection by inserting spaces before the first character of each selection.

vamolessa commented 2 years ago

At first this seems like a complex feature. From looking at the example gif, it seems that it detects that there are two columns and align cursors accordingly. What happens if there's a different number of cursors on each line? Does it try to match the closest cursors along each column? Or does it simply match the nth cursor of each line? Or something different?

Also, this is certainly something that could be accomplished today by a code plugin.

NNBnh commented 2 years ago

What happens if there's a different number of cursors on each line? Does it try to match the closest cursors along each column? Or does it simply match the nth cursor of each line? Or something different?

I have come back to Kakoune and play around a bit to confirm that: Yes "it simply match the nth cursor of each line"!

Before After
Before After