Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime 2, how to auto close HTML tags and place cursor inside the tag

I'm trying to figure out how to get Sublime 2 to create the following behavior:

Type

<strong

then, upon typing >

Sublime will then immediately print

<strong></strong>

And then your cursor will be placed inside of the tag.

I feel like it did this automatically not more than a few months ago, or maybe I was just hallucinating, or was using a different bundle... but regardless, is there a setting or script I can build that will perform this tag behavior that Aptana gets 100% right but for some reason no other text editor can catch on to?

like image 281
M. Ryan Avatar asked Nov 19 '12 15:11

M. Ryan


People also ask

How do I automatically close a tag in Sublime text?

But there should be some built into sublime. For example, as you start to type <div> , you should see a drop down box with matching snippets. Hit Tab or Enter to pick one and arrow keys to go up or down in the list. For html tags, it will automatically adds the closing tag and puts the cursor in between them.

How do you select an opening and closing tag in html?

An opening tag begins a section of page content, and a closing tag ends it. For example, to markup a section of text as a paragraph, you would open the paragraph with an opening paragraph tag <p> and close it with a closing paragraph tag </p> (closing tags always proceed the element with a /).

How do I select html in Sublime text?

You can select some text and then choose Edit > Tag > Wrap Selection with tag from the menu (or use the key binding you'll see when you look there) to do this.

How do I use tags in Sublime text?

To wrap your selected content with a html tag, just selected your text, then press Alt-Shift-W. You'll then have the option to fill in the front and back tag simultaneously.


1 Answers

  1. CTRL + SHIFT + W (in Mac) / ALT + SHIFT + W (in Windows)
  2. type "strong"
  3. TAB
like image 84
Fellow Stranger Avatar answered Oct 26 '22 22:10

Fellow Stranger