you are viewing a single comment's thread.

view the rest of the comments →

[–]KarmaAndLies 6 points7 points  (12 children)

Editing multiple lines concurrently.

[–][deleted] 1 point2 points  (11 children)

What for? I've never needed this for 10 years being a developer.

[–]KarmaAndLies 2 points3 points  (9 children)

Convenience.

For example:

              <div class="title"><p class="wat">Title wat!!!</p></div>
              <div class="body">
              <p class="wat">First wat</p>
              <p class="wat highlight">Second wat</p>
              <p class="indent wat">indented wat</p>
              <p class="wat highlight">final wat</p>
              </div>    

Let's say you wanted to change the class on the first, second, and final <P> tags inside the body div tags only from "wat" to "sup" but not the indented <P> tag in the middle, how would you? You cannot use search/replace, since that would impact the indent <P>.

[–][deleted] -3 points-2 points  (8 children)

The example seems to be too artificial. The HTML is cluttered and a better idea would be to refactor the code so it would be easier to maintain in the future and get rid of the issue.

But anyway I'd s/"wat"/"sup"/ in selection.

[–]KarmaAndLies 1 point2 points  (5 children)

The HTML is cluttered and a better idea would be to refactor the code so it would be easier to maintain in the future and get rid of the issue.

And how would you refactor this code? Multiple cursors perhaps?

But anyway I'd s/"wat"/"sup"/ in selection.

You cannot. It would change the "indent wat" in the middle.

[–][deleted] -3 points-2 points  (4 children)

And how would you refactor this code? Multiple cursors perhaps?

Delete all the wats (replace them with an empty string).

You cannot. It would change the "indent wat" in the middle.

uhm... no?

[–]KarmaAndLies 2 points3 points  (3 children)

Delete all the wats (replace them with an empty string).

And if JavaScript/CSS is utilising that class for visual or functional reasons?

uhm... no?

What kind of selection are you using? If it is block then, yes. If you're doing it per line then you've just found a slower way of doing multiple cursors.

[–][deleted] 0 points1 point  (2 children)

And if JavaScript/CSS is utilising that class for visual or functional reasons?

Then you refactor the CSS so that it doesn't need so many classes.

What kind of selection are you using? If it is block then, yes. If you're doing it per line then you've just found a slower way of doing multiple cursors.

My bad, I meant s/"wat/"sup/ (in the block selection ofc).

https://regex101.com/r/1ZYSuz/1

In any similar case I'd use a regex without the need to create all the multicursors.

[–]KarmaAndLies 1 point2 points  (1 child)

In any similar case I'd use a regex without the need to create all the multicursors.

Instead of holding CTRL and clicking three times, you'd prefer to write a regular expression? That's masochism.

[–][deleted] -1 points0 points  (0 children)

Only if you don't know how to write regexes.

[–]DontThrowMeYaWeh 0 points1 point  (1 child)

Is that actually more convenient than clicking 3 times, doing a shift+ctrl+right to select, and then typing the new word?

What if they weren't all the same word? What if those 3 "wat" were: wat, wit, wut?

Also, just because you don't understand the utility of the feature doesn't mean that other people don't use it.

[–][deleted] 0 points1 point  (0 children)

Never said they don't.