mbigras
mbigras

Reputation: 8055

How to use multiple cursors efficiently in this case?

The stage is set: I'm about to add three li s to an ul and I think it would be a good application of multiple cursors in ST2. I'm not sure how to do this.

At step 1. what I'd really like to be able to do is: "open 2 new lines with 2 new cursors". I don't think it possible to do that so instead I tried opening 2 new lines manually (step 2) and than applying multiple cursors using ctrl+shift+up except then the cursors end up in a not-so-ideal spot (step 3).

Even if I hold cmd and click the cursors end up in the same not-so-ideal spot (step 3). So my question is how can I efficiently apply multiple cursors to my situation?

enter image description here

Trying Harpreet's technique doesn't seem to work for me: enter image description here

Upvotes: 1

Views: 102

Answers (3)

Angus Yeh
Angus Yeh

Reputation: 447

I think this is an open-ended question.

In your very first attempt, if you replace two of the enters by ctrl+shift+d (duplicate_line), you will find when you do multi cursor up (select_lines), it will give you the positioning you wanted.

The cause of your problem is that your original three empty lines aren't actually the same (due to whatever indentation mechanism). And the best way of using multi-cursor is using them on structurally identical lines.

Of course in practice, it all depends on where your cursor currently is. For example if I am near the other < li >s, I might actually ctrl+shift+d (duplicate_line) a few times until I get 3 new < li >s before I ctrl+shift+down (swap_line_down) a few times to get them into that < ul >.

Upvotes: 0

Sid Verma
Sid Verma

Reputation: 576

When you end up in what you call not-so-ideal spot, press the 'Home' button twice on your keyboard, you'd be taken to the start of each line, then press tab four times to go to your 'ideal spot'.

Upvotes: 1

Harpreet Singh
Harpreet Singh

Reputation: 2671

Edit

enter image description here

Earlier Answer

After your Step 3

  1. Press Upper Key Arrow
  2. Press Down Key Arrow
  3. Use tab key to go to proper position
  4. type li (s)

enter image description here

Upvotes: 3

Related Questions