Sublime Forum

Wrap selected line in html tags

#1

I am trying to wrap a highlighted line/text with an html element tags, i.e.

. I searched and found a few topics, but their solutions don’t seem to work for me. I am guessing that one of the plugins or settings is interfering with it. Suggestions?

Thanks, in advance.

0 Likes

#2

ctrl+shift+w should work. Works for me on OSX

0 Likes

#3

in windows its alt+shift+w

0 Likes

#4

Perfect, thanks!

0 Likes

#5

It does the job but not same as OSX. I gues OSX defaults to emmet wrap.
I just found and write here.
Ctrl + Shift + g

1 Like

#6

Helllo, I am not able to do an alt+shift+w (unless I use my toes). Can you recommend an alt+w solution?

– David

0 Likes

#7

The key binding for that is the following:

	{ "keys": ["alt+shift+w"], "command": "insert_snippet", 
      "args": { "name": "Packages/XML/Snippets/xml-long-tag.sublime-snippet" } },

You can use Preferences > Key Bindings from the menu and add this to your custom key bindings, and change the key as appropriate (say to alt+w) and you should be good to go.

0 Likes

#8

Thanks. However, I can’t get this to work. Should the command name be something like “wrap_line_in_tags”? – David

0 Likes

#9

No, this functionality uses a snippet to perform this task. The binding above is the default binding that does this, and the menu entry also uses the same command.

Just to clarify, copying that binding and altering the key to something else, it still doesn’t do anything when you press the new key?

1 Like

#10

Correct. But I created a macro and did a keybind to ctrl+;

And it works! So I am okay now. Thanks, T – David

1 Like