Sublime Forum

Help with a Textmate command ported over

#1

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 <>*</>)

// 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.

0 Likes

#2

[quote=“jcontonio”]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 <>*</>)

// 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.[/quote]

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

[pre=#232323]
${2:$SELECTION}]]>
<
text.xml
Long Tag
[/pre]

0 Likes

#3

There is already this feature. Hit Alt+Shift+W then type the tag.

0 Likes

#4

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

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.

0 Likes

#5

That’s what the zencoding plugin does.

0 Likes