1

New to the coding game, and familiarizing myself with Sublime Text and its plugins on Windows10. After much searching, I finally figured out that v 3 and 4 do not offer the inherent ctrl+shift+g macro to wrap with abbreviation, so I manually binded those keys to that command:

{"keys": ["ctrl+shift+g"], "command": "emmet_wrap_with_abbreviation"}, The problem now is I can't get $$ for multiple lines to sequence, i.e. 01-07. It instead outputs 01-01.

For example:

Typed Monday-Sunday on separate lines. Shif+right-click highlight days to tag and wrap individual lines. ctrl+shift+g to bring up emmet wrap abbreviation command line.

In line typed li.day-$$>span

Output:

<li class="day-01"><span>Monday</span></li>
<li class="day-01"><span>Tuesday</span></li>
<li class="day-01"><span>Wednesday</span></li>
<li class="day-01"><span>Thursday</span></li>
<li class="day-01"><span>Friday</span></li>
<li class="day-01"><span>Saturday</span></li>
<li class="day-01"><span>Sunday</span></li>

But should have been:

<li class="day-01"><span>Monday</span></li>
<li class="day-02"><span>Tuesday</span></li>
<li class="day-03"><span>Wednesday</span></li>
<li class="day-04"><span>Thursday</span></li>
<li class="day-05"><span>Friday</span></li>
<li class="day-06"><span>Saturday</span></li>
<li class="day-07"><span>Sunday</span></li>

as it was in a tutorial I was watching. Although, the tutorial was from 2014, so it would have been an older version of Sublime as well as Emmet, if that matters. Additionally, since the binded keys performed the function of bringing up the wrap abbreviation command line, I suspect a function in the line itself, but I'm not sure what or why.

bad_coder
  • 11,289
  • 20
  • 44
  • 72

1 Answers1

2

It looks like you’ve used multiple cursors to select each line individually then wrapped it with abbreviation. Instead, you should select text you want to wrap as a single selection.

Also, when wrapping multiline text, you should mark repeated element with *. In your case, abbreviation should look like this: li.day-$$*>span

https://docs.emmet.io/actions/wrap-with-abbreviation/#wrapping-individual-lines

Sergey Chikuyonok
  • 2,626
  • 14
  • 13
  • I understand what you're saying. What I am trying to understand is a different method utilizing the Emmet plugin, but for some reason getting a different result from that presented in this tutorial from about the 3:45 mark: https://youtu.be/U4lFXtLF5Cs – Den_of_Barjack Sep 01 '21 at 21:38
  • In this video, author _expands_ abbreviation, but you’re trying to _wrap_ text using multiple cursors – Sergey Chikuyonok Sep 03 '21 at 10:47
  • I am literally doing exactly what the creator of the video is doing, step by step, specifically from the 4:45 ish mark, but getting an augmented result. I'm trying to understand why. – Den_of_Barjack Sep 04 '21 at 05:52
  • You don’t have to use multiple cursors (i.e. Alt-drag selection). Just create a regular single selection then call Wrap With Abbreviation action – Sergey Chikuyonok Sep 14 '21 at 09:22