user1418036
user1418036

Reputation: 21

Zen Coding + wrap with abbreviation in Sublime Text 2

I'd like to wrap some list items with the following Zen Coding abbreviation in Sublime Text 2:

nav>ul.example>li*4

This is an example of the list:

Dog
Cat
Horse
Cow

How do I do this?

Upvotes: 2

Views: 2668

Answers (5)

Stefan Gruenwald
Stefan Gruenwald

Reputation: 2640

You don't have to do it this complicated. You can just select the list of items you want (go over it with the mouse). Make sure you are in html mode and NOT in text mode. Then you just type div>nav.element>li* into the bottom line under Koan coding (CTRL option return - could be different on your system) and all the list items are within the code.

If you have a list with websites, you just have to type a* to get them all wrapped around with a hyperlink. Is fairly useful.

Upvotes: 0

Beckafly
Beckafly

Reputation: 411

on linux: ctrl shift g (to expose zencoding/emmet comand line) then type your elements without increment number at the end, just the *, as Sergey pointed out!

Upvotes: 0

Seth Urquhart
Seth Urquhart

Reputation: 599

This will take two steps, at least this is the easiest way I have found to do it:

  1. Select your list, if there are breaks in your list you'll want to use (Ctr) for Windows, (Cmd) for Mac, and select each line of the list you want a surrounding tag.

  2. Hit (Crt/Cmd) + (Shift) + (L), then (Home) for the front of the text for your tag, (End) for the end of the text for your closing tag.

This will edit all lists items at the same time making for very quick and efficient editing, this is one of the main perks to Sublime Text 2 :)

Let me know if this didn't made sense so I can better explain.

Upvotes: 0

Sumeet Chawla
Sumeet Chawla

Reputation: 86

though it's out of context, may be this tool will be of some help. It can wrap text or create long lists with different html tags like li, option etc. Just paste text and hit button, rest is copied in clipboard. It even has a chrome extension to make things faster. Not as fast as zen coding but useful when you want to wrap 100 text elements in a list :)

Upvotes: 0

Sergey Chikuyonok
Sergey Chikuyonok

Reputation: 2691

When you want to wrap each line of selection with element of abbreviation, you need to mark this element as repeating with * operator.

Thus, your abbreviation should look like this:

nav>ul.example>li*

(e.g. no multiplier value, just *)

Upvotes: 8

Related Questions