How to select from an element's opening tag to it's closing tag?


When cleaning up html I often find myself scrolling up and down the document to select an element’s opening and closing tags so I can move it or adjust its indentation.

It’d be great if there was a way to do semi-automate this, e.g. a shortcut that would select the current element (opening tag to closing tag), another to select the parent, etc. Does anything like that exist? Thx!


Found this: - the planned ‘Expand Selection to Tag’ functionality is not yet there though.


I need this.


This is amazing — this feature is an essential one yet nobody thought to code it up. This should be #1 on the Atom dev’s to-do list. Without automated way to select whole tag it’s unreliable and tedious.

Even decrepit Dreamweaver had “Collapse Full Tag” which let to get collapsed opening tag, its closing tag and in-between.

I’ve seen screencasts of very influential and famous front-end devs teaching others on Sublime and relying only on indentation to select tags…

We need this feature like yesterday.


The amazing part about Atom being open source is that anyone can submit changes, fixes, or enhancements. There are only so many official Atom maintainers, so perhaps someone from the community can help out by submitting a Pull Request or publishing a package?


Well, on my version, Ctrl-M goes to matching brace or tag, and Ctrl-Alt-M does the same, selecting in between.
Looks official:

'.platform-win32 atom-text-editor':
  'ctrl-alt-m': 'bracket-matcher:select-inside-brackets'

Done by bracket-matcher which is a core package.


@PhiLho sure, but we are talking about how to select let’s say whole DIV with its contents, the automated way.

Like CTRL+ALT+M but including opening and closing tag…

It would be a huge time saver, wouldn’t it?


Ah, indeed, this shortcut selects text inside the braces (or tags), which can make sense (eg. if you want to empty the content of the braces), and is enough for indentation purpose, but annoying when you want to cut (or copy) the whole block with the delimiters.
A possible improvement would be to have another Ctrl-Alt-M to extend the selection to the braces.
Not sure if a GitHub issue has been opened on the topic.


There is a ticket on it already:


Emmet has keybindings that expand/reduce selections to a tag which they call “balance outward/inward”:

  • Balance (outward): ctrl-shift-E
  • Balance (inward): ctrl-shift-0

Emmet for Atom docs: