Home Download Buy Blog Forum Support

How to make HTML tags behave same as brackets

How to make HTML tags behave same as brackets

Postby szameks on Sat Aug 14, 2010 12:57 pm

Hello, first of all excouse my english please :)

Maybe guys you can help me.
I wanted editor to react with html tags same way as he reacts with brackets when i hit enter with cursor in the middle of them.

Code: Select all
<div>cursor</div>

* hit enter * (or shift+enter for example)

Code: Select all
<div>
   cursor
</div>


Any hint how I can achive that?
szameks
 
Posts: 10
Joined: Fri Nov 27, 2009 1:12 pm

Re: How to make HTML tags behave same as brackets

Postby jps on Sun Aug 15, 2010 1:11 am

Adding this to your user key bindings should do the trick:

Code: Select all
<binding key="enter" command="insertInlineSnippet '\n\t$0\n'">
   <context name="option" value="autoIndent"/>
   <context name="allSelectionsEmpty" value="true"/>
   <context name="allPrecedingCharacter" value="&lt;"/>
   <context name="allFollowingCharacter" value="&gt;"/>
</binding>


The equivalent version for brackets is defined in the default key bindings - this is just a slightly reworked version of that.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: How to make HTML tags behave same as brackets

Postby szameks on Sun Aug 15, 2010 7:57 am

Had to change "allPrecedingCharacter" to "&gt;" and "allFollowingCharacter" to "&lt; but now it works I wanted.

Thank you for help.
szameks
 
Posts: 10
Joined: Fri Nov 27, 2009 1:12 pm


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 31 guests