Home Download Buy Blog Forum Support

Help with a Textmate command ported over

Help with a Textmate command ported over

Postby jcontonio on Wed May 30, 2012 11:42 pm

Hello there,

First post here. Love this app.

I added the following to my user keys to get the ctrl-shift-, functionality from Textmate (wrap whatever in a tag, edit the tag, tab to the <>*</>)

Code: Select all
// textmate style: take selection and wrap in a tag
{ "keys": ["ctrl+shift+,"], "command": "insert_snippet", "args": {"contents": "<${1:p}>${2:$TM_SELECTED_TEXT}</${1/s.*//}>" } },


Now, it's working as expected up until I backspace the open tag and start typing...the closing tag doesn't mirror it.

Does anyone have this working? It's the command I use the most.
jcontonio
 
Posts: 8
Joined: Wed May 30, 2012 11:40 pm

Re: Help with a Textmate command ported over

Postby atomi on Thu May 31, 2012 2:10 am

jcontonio wrote:Hello there,

First post here. Love this app.

I added the following to my user keys to get the ctrl-shift-, functionality from Textmate (wrap whatever in a tag, edit the tag, tab to the <>*</>)

Code: Select all
// textmate style: take selection and wrap in a tag
{ "keys": ["ctrl+shift+,"], "command": "insert_snippet", "args": {"contents": "<${1:p}>${2:$TM_SELECTED_TEXT}</${1/s.*//}>" } },


Now, it's working as expected up until I backspace the open tag and start typing...the closing tag doesn't mirror it.

Does anyone have this working? It's the command I use the most.


Do you mean like alt+shift+w? Check out Packages/XML/long-tag.sublime-snippet it might be what you want:

<snippet>
<content><![CDATA[<${1:p}>${2:$SELECTION}</${1/([^ ]+).*/$1/}>]]></content>
<tabTrigger>&lt;</tabTrigger>
<scope>text.xml</scope>
<description>Long Tag</description>
</snippet>
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: Help with a Textmate command ported over

Postby jbrooksuk on Thu May 31, 2012 10:23 am

There is already this feature. Hit Alt+Shift+W then type the tag.
jbrooksuk
 
Posts: 765
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Help with a Textmate command ported over

Postby jcontonio on Thu May 31, 2012 3:45 pm

It's not exactly the same.

With Textmate you don't need to highlight the character, you just type "p" and then hit the command and it turns it into the tag, with the focus between the tags

With the same command, with no character typed, you hit the command and it'll make <p></p> with the first p highlighted, typing anything you want to match, then you hit tab to go into the middle.

It's close, but not exactly the same. I am so close.
jcontonio
 
Posts: 8
Joined: Wed May 30, 2012 11:40 pm

Re: Help with a Textmate command ported over

Postby C0D312 on Thu May 31, 2012 3:47 pm

That's what the zencoding plugin does.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am


Return to Technical Support

Who is online

Users browsing this forum: Majestic-12 [Bot], Yahoo [Bot] and 15 guests