vamolessa / pepper

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

Support combines selections from the register with the current ones and the other way around. #55

Open NNBnh opened 2 years ago

NNBnh commented 2 years ago

This would help a lot with manipulate complex multi selection. From Kakoune's keys docs:

Alt-z combines selections from the register with the current ones, whereas Alt-Z combines current selections with the ones in the register; a menu is then displayed which waits for one of the following additional keys:

  • a append selections.
  • u keep a union of selections.
  • i keep an intersection of selections.
  • < select the selection with the leftmost cursor for each pair.
  • > select the selection with the rightmost cursor for each pair.
  • + select the longest selection
  • - select the shortest selection.

(I don't think <, >, + and - is useful)

This require #54 to be done.

vamolessa commented 2 years ago

Pepper does not really have a way to save cursors to a register. What it does is save a path + line + column (main cursor's position). It could indeed be extended to support multiple cursors as #54 suggests.

However, I'm not sure how that would work when trying to combine cursors from another file. Say you're on buffer a and bookmark it's current cursor state to register p. Then you open buffer b. Now would 'append cursors from register p' ignore that they're buffer a cursors? Or do nothing in that case? Or even just go to buffer a and restore its selections?

NNBnh commented 2 years ago

Sorry for the late reply.

However, I'm not sure how that would work when trying to combine cursors from another file. Say you're on buffer a and bookmark it's current cursor state to register p. Then you open buffer b. Now would 'append cursors from register p' ignore that they're buffer a cursors? Or do nothing in that case? Or even just go to buffer a and restore its selections?

So I have reinstall Kakoune and try this out:

Both display this message:

image

We could make Pepper behave the same.