Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Surround selection with html tag

Tags:

html

eclipse

Is there any eclipse shortcut/trick/plugin/whatever that will allow me to select a section of text and surround it with an arbitrary html/xml tag when using the html editor.

Something like this textmate video

like image 946
Bogdan Avatar asked Mar 15 '12 13:03

Bogdan


People also ask

What surrounds all HTML tags?

All attributes are optional. The BODY tag surrounds all the content of your site. It allows you to set the look and feel of your site through its attributes.

How do you enclose a tag in HTML?

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 /).

Why would you surround a piece of text with tags?

In general, they make a document easier to read by breaking up a large document into smaller parts, each part having a heading that has different formatting (larger text, bold, etc.), than the rest of the document.


2 Answers

EDIT: not sure If my Eclipse setup is the same as yours, but...

I have the HTML Editor installed, and if I switch to the Java perspective, I can use Edit -> Quick Fix and then choose Surround with new element to get exactly the effect in your video. (On a Mac, the shortcut for this is ⌘1).

Hope this is helpful.

In the C++ editor, you can try Source -> Surround With... -> Configure Templates to add the tag you want.

like image 157
Richard Inglis Avatar answered Oct 14 '22 05:10

Richard Inglis


The following works and allows for entering random/arbitrary tags:

  1. Select the desired text that you want wrap.
  2. Go to 'Edit > Quick Fix' or press 'Ctrl + 1'.
  3. In the new menu that appears select 'Surround with new element'

However there is an annoyance, please upvote Bug 494169

Eclipse Surround Selection With HTML Tag

like image 31
Daniel Sokolowski Avatar answered Oct 14 '22 07:10

Daniel Sokolowski