Home Download Buy Blog Forum Support

XML tag auto-close

XML tag auto-close

Postby thewonderer on Tue Jan 25, 2011 9:54 am

Hi,

I'm new to Sublime and it just might be the perfect editor if I could discover how to achieve XML tag auto-close.
What I mean is:

I type in <mytag> and Sublime inserts </mytag> for me.

HTML auto-completion doesn't seem to work, because in XML you can (and will) name your tags whatever you want.
thewonderer
 
Posts: 3
Joined: Tue Jan 25, 2011 9:49 am

Re: XML tag auto-close

Postby guillermooo on Tue Jan 25, 2011 10:46 am

guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: XML tag auto-close

Postby thewonderer on Wed Jan 26, 2011 7:28 am

Hi. Snippets. Nice things.

I don't know if yours works, because I don't know how to trigger it. There is an existing XML snippet that's seems even better, it pairs tags, so when you edit the start tag, you also edit the end tag. However, I don't know how to trigger that one too.

It says <, TAB. If I press TAB though, it just inserts a Tabulator, like you'd expect it would. What am I missing?
thewonderer
 
Posts: 3
Joined: Tue Jan 25, 2011 9:49 am

Re: XML tag auto-close

Postby guillermooo on Wed Jan 26, 2011 7:51 am

Does > + TAB work for you?

Maybe < + TAB doesn't work due to autopairing of angle brackets.

Once saved under Packages\User, my snippet should kick in if you typed: tag + TAB.
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: XML tag auto-close

Postby thewonderer on Wed Jan 26, 2011 8:37 am

Wonderful, my friend. It worked indeed. Thank you!
thewonderer
 
Posts: 3
Joined: Tue Jan 25, 2011 9:49 am

Re: XML tag auto-close

Postby gpfsmurf on Wed Jan 26, 2011 8:38 pm

guillermooo wrote:Maybe < + TAB doesn't work due to autopairing of angle brackets.

That's right, take it off and it works.
gpfsmurf
 
Posts: 211
Joined: Mon Jun 23, 2008 6:31 pm


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], jbrooksuk and 21 guests