Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change both opening and closing html tags in atom editor at the same time?

Tags:

atom-editor

If I have something like this <span>some<span>text</span></span> and I want to change outermost span tag to something else, and to change both the opening and the closing tag at the same time, how can I do that with the Atom editor? I know that cmd+d shortcut selects the same text forward but in this case it will select the inner span tags also which I want to avoid.

like image 402
Saša Šijak Avatar asked Oct 14 '15 07:10

Saša Šijak


People also ask

Which tags have both opening and closing tags?

Tags with opening and closing tags are called container tags, and tags with only one opening tag and no closing tag are called empty tags.

How do you close and open HTML tags?

An opening tag begins a section of page content, and a closing tag ends it. For example, to markup a section of text as a paragraph, you would open the paragraph with an opening paragraph tag <p> and close it with a closing paragraph tag </p> (closing tags always proceed the element with a /).

Do all HTML elements need both opening and closing tags?

All tags in HTML does not need opening and closing tags. Some are standalone tags also. Container tags are those tags which have beginning and closing tags.

What is the text or other elements that are enclosed between the opening and closing tags of an HTML element?

</TITLE> The text between the opening and the closing tags is a title for the hypertext node. There should only be one title in any node.


1 Answers

With ctrl + (click in text) (or cmd + (click in text) on Mac) you can create multiple cursors. So you can add a second one to change both tags at once.

Thats the only method I know atm.

Edit: There is a shortcut ctrl + d or cmd + d which with you can mark same occurrences of the text.

There is also a package which does exactly what you want: https://github.com/dsandstrom/atom-double-tag

like image 67
mstruebing Avatar answered Sep 19 '22 01:09

mstruebing