Leander
Leander

Reputation: 352

Sublime Text 3 / Emmet – Select both opening & closing tag (via Shortcut)

Just a quick question in order to optimize my workflow / productivity with Sublime Text 3 & Emmet...

So far I am able to (on Mac)

But what I haven't found out yet is a way to select the opening and closing tag completely (with all possible values) in order to delete the surrounding tags.

To illustrate...

<span style="color: #660066;"><strong>Lorem ipsum dolor sit amed</strong></span>

Running CMD + Shift + K renders this selection:

enter image description here

...which doesn't allow me to instantly delete the code.

Any ideas / hints / workarounds you can think of? I researched both the web and the Sublime Text docs but to no avail...

Thanks & regards!

Upvotes: 1

Views: 2288

Answers (1)

fnkymnky
fnkymnky

Reputation: 94

Highlight the tag you want to remove the opening and closing tags for and try CTRL + SHIFT + ;

That should delete the selected tag and it's closing partner.

The emmet documentation has this as the remove tag shortcut, but states the shortcut is CTRL + SHIFT + K, when infact (on my setup at least), it's CTRL + SHIFT + ; in Sublime Text 3.

If this doesn't work, you should be able to find what the default key binding is by checking your default key bindings file under Preferences > Package Settings > Emmet > Key Bindings - Default. Run a search in this file for "remove_tag" and see what binding is attached to it.

If for some reason it doesn't exist or you'd like to change the binding, you can do so by editing your user key bindings file under Preferences > Package Settings > Emmet > Key Bindings - User.

Simply add:

 [
  {
    "keys": [
        "shift+ctrl+;"
    ], 
    "args": {
        "action": "remove_tag"
    }, 
    "command": "run_emmet_action", 
    "context": [
        {
            "key": "emmet_action_enabled.remove_tag"
        }
    ]
  }
 ]

Upvotes: 3

Related Questions