krasa / StringManipulation

IntelliJ plugin - https://plugins.jetbrains.com/plugin/2162
Apache License 2.0
694 stars 81 forks source link

Multi Caret "Select until.." #165

Open j-a-s-o-n-g opened 2 years ago

j-a-s-o-n-g commented 2 years ago

Often times I have strings that are not the same length that I need to select until a certain character per line. Using IntelliJ's default tools, and even with some plugins, it's not always achievable.

Say you have this multi-caret in your text editor, where | is the multi caret:

|test-test.test |test-test-test.test |test-test-test-test-test.test |test-test-test-test-test-test.test

How do you achieve this selection where [] are the selection boundaries?

[test-test].test [test-test-test].test [test-test-test-test-test].test [test-test-test-test-test-test].test

This is a VERY simple use case, the ones I deal with are far more complex.

Rules: 1.) Must only work with the carets already existing. 2.) You can't cheat this by going to the end of each line and working backwards because the end of each line has the same number of words/characters. 3.) Can't select all instances of period and work back.

Also, yes you can also use a regex search within selection, but I am looking for push button solution that requires minimal if not zero setup or complexity.

One solution would be a multi character supported "select until" function or popup where you type in the character after executing the command and it looks forwards or backwards for your query.

Sublime text has an addon that does just this: https://github.com/xavi-/sublime-selectuntil

krasa commented 2 years ago

sounds nice

j-a-s-o-n-g commented 2 years ago

As much as I would like this to be in Missing In Actions (as well as it makes sense to be there), it is never going to happen sadly. The best hope for this idea is in this project. :) @krasa

Tom-Evers commented 2 years ago

Just fyi, that example is easily achievable with IntelliJ's default functionality:

  1. Place your multiline caret
  2. Hold <shift> while pressing <end> to select every line to the end
  3. Keep holding <shift> and hold <ctrl> while using the arrow keys to select/deselect entire words

Multiselect

krasa commented 2 years ago

in this case yes, in other more random inputs no.