I’ve recently converted from E-Texteditor and one of the only features i miss it the ablity to wrap a selection in a html tag.
I would highlight the selection > press ctrl alt w > and type the tag letters “p”. Is this possible with sublime?
I’ve recently converted from E-Texteditor and one of the only features i miss it the ablity to wrap a selection in a html tag.
I would highlight the selection > press ctrl alt w > and type the tag letters “p”. Is this possible with sublime?
In Sublime Text all easier — highlight the selection, type tag name and press the tab key.
when I do that, it just replaces the selection with the tag (e.g., ‘p’) and tab, literally. syntax is set to html.
Firstly it replaces the selection with typed tag, but after pressing tab key the selection reappears already inside the tag.
Or something I do not understand and this functionality is dependent on any plug-ins? http://forums.disenteria.ru/style_emoticons/default/upset.gif
Wrapping the text as ilya described is the default behaviour, perhaps this has been changed for you by a plugin.
Jon, I think I found a possible bug.
I did a clean reinstall to find where the problem is and traced it to my keymap file. If I use mine keymap instead of Default, it breaks the tag wrap behavior. So I copied Default.sublime-keymap to temp.sublime-keymap to get a fresh restart. But without changing anything else, just setting
keymap temp
in Application.sublime-options breaks the tag wrap.
Then I copied and pasted my keymap file into Default.sublime-keymap and set it back to
keymap Default
and the wrap tag behavior is OK!
if you take a look in the PowerUser package I provided I made a textmatetag.sublime-snippet…
basically it allows you to wrap an elemnt in a tag just exactly as it works in textmate or e-text
and for those that don’t want to bother downloading the package here it is…
[code]
[/code]and the snippet…
<snippet>
<content><![CDATA[<${1:p}>${0:$SELECTION}</${1/\s.*//}>]]></content>
</snippet>
the regex in the snippet makes sure that when you type a tag with attributes the attributes don’t get mirrored in the closing tag… default behavior in sublime it does… not good
[quote=“barty”]Jon, I think I found a possible bug.
I did a clean reinstall to find where the problem is and traced it to my keymap file. If I use mine keymap instead of Default, it breaks the tag wrap behavior. So I copied Default.sublime-keymap to temp.sublime-keymap to get a fresh restart. But without changing anything else, just setting
keymap temp
in Application.sublime-options breaks the tag wrap.
Then I copied and pasted my keymap file into Default.sublime-keymap and set it back to
keymap Default
and the wrap tag behavior is OK![/quote]
I figured out my problem: the wrap tag function requires Default.sublime-keymap in the html package. When I change the keymap file to something other than Default, that file no longer gets loaded so the wrap tag feature (and others) no longer works.
Hi there!
I realize this is an old thread but I’m trying to achieve the same thing as the original poster and I’m having the same problems except that I have a clean install of Sublime Text 2. I’m on OSX and I looked in ~/Library/Application Support/Sublime Text 2 and opened files that made sense to me but I can’t figure it out. Any help/pointers you guys can give me would be great!
Thanks
The above mechanisms won’t work with Sublime Text 2, however I’m planning on adding tag wrapping to the next version
In ST2 I miss this behavior: Select text > type tag > press tab > selected text become wrapped with typed tag.
This will implemented in next version? Next beta of ST2 or next version of ST3?
Just add this into your keymak conf file:
{
"keys" : "alt+shift+w"],
"command" : "insert_snippet",
"args": {
"contents": "<${1:p}>${0:$SELECTION}</${1}>"
}
}
[quote=“ilya”]In ST2 I miss this behavior: Select text > type tag > press tab > selected text become wrapped with typed tag.
This will implemented in next version? Next beta of ST2 or next version of ST3? [/quote]
I miss this too.
[quote=“etune”]
[quote=“ilya”]In ST2 I miss this behavior: Select text > type tag > press tab > selected text become wrapped with typed tag.
This will implemented in next version? Next beta of ST2 or next version of ST3? [/quote]
I miss this too.[/quote]
There’s the tag plugin for this now: github.com/sublimetext/tag
i always replace the selection with the tag and tab, literally. syntax is set to html.
I had this same problem this morning. Looks like there are plugins/snippets that will work, but Control + Shift + W accomplished this for me.