richrd / suplemon

:lemon: Console (CLI) text editor with multi cursor support. Suplemon replicates Sublime Text like functionality in the terminal. Try it out, give feedback, fork it!
MIT License
787 stars 43 forks source link

[Wishlist] in multi cursor mode execute find for each cursor #227

Closed Consolatis closed 5 years ago

Consolatis commented 6 years ago

Or provide a second function like find which works for multi cursor. That would actually be more useful because then find can still be used to create multiple cursors.

e.g. if we have following code:

        # backspace is tricky:
        # ctrl+backspace returns keycode 8
        # backspace returns keycode 127/KEY_BACKSPACE
        _fmt("backspace"):                         127,
        _fmt("backspace"):                         "KEY_BACKSPACE",
        _fmt("backspace", "alt"):                  "m-KEY_BACKSPACE",
        _fmt("backspace", "alt"):                  "m-c127",
        _fmt("backspace", "alt", "ctrl"):          "m-c8",
        _fmt("backspace", "ctrl"):                 8,
        # additional modifyOtherKeys variants
        _fmt("backspace"):                         "c127",
        _fmt("backspace", "alt", "ctrl"):          "m-c-c8",
        _fmt("backspace", "alt", "ctrl", "shift"): "m-c-s-c8",
        _fmt("backspace", "alt", "shift"):         "m-s-c127",
        _fmt("backspace", "ctrl"):                 "c8",
        _fmt("backspace", "ctrl", "shift"):        "c-s-c8",
        _fmt("backspace", "shift"):                "s-c127",

Target: convert it into a format like (last line as example) add("shift", "backspace", "s-c127") That is, move "backspace" to be the second last parameter and replace "_fmt" by "add" and "):" by "," and ",$" by ")".

Edit: Just recognized I don't need to move the parameter at all, but the same issue exists for converting "):" to "," and it would generally be a useful feature to have.

richrd commented 6 years ago

Here's how I would proceed with your use case (with the suplemon limitations):

Basically the idea here is, that since we can't make selections within lines, we move what we want to its own line. The it can be cut/copied and after that the lines can be joined back to what they were before.

If we had real selections this would be so much easier... :thinking:

Consolatis commented 6 years ago

press ESC and find "):" and select all

Yes one can return to single cursor mode and create a new set of multi cursors. Personally, I'd prefer a find like feature (which doesn't create new cursors) which works for multiple cursors though.

richrd commented 5 years ago

Afaik sublime doesn't do this either so closing for now. It might be done in the future.