Alt+Insert for quickly wrapping selected text

Posted by HTML-Kit Support February 6, 2012
 

This feature was delivered in HTML-Kit Tools update 20120202. To make sure that you have the latest additions, select "Help > Check for Updates" from the main menu.

Want a quick way to type a tag, without typing all those less than and greater than characters? And without having to type the closing tag? Try Alt+Insert keyboard shortcut.

Here's a quick video demonstration of this feature:

 

In the simplest form, you can press Alt+Insert and type the name of a tag to insert that tag at the caret. No selection is necessary.

Press Alt+Insert, type "p" without quotes and press Enter to get the following. The caret is automatically placed in between opening and closing tags.

<p>|</p>

If you had selected some text before pressing Alt+Insert, the paragraph tag would have surrounded the text. Note that "|" represents where the caret would be placed.

<p>selected text</p>|

How about with some attributes. Typing this:

a href="about.html"

would insert the following. As you see, you can manually type in attributes.

<a href="about.html">|</a>

Alt+Insert provides even quicker ways to insert CLASS and ID -- two of the most commonly used attributes. After pressing Alt+Insert, type a tag name followed by "#" character (without quotes and no spaces). Now you can type the actual ID to quickly add an id="name" attribute. For example:

div#menubar

becomes:

<div id="menubar">|</div>

The same applies to the CLASS attribute, except the separator character is "." (period character). After pressing Alt+Insert, type a tag name followed by "." character (without quotes and no spaces). Now you can type a class name to quickly add a class="class name" attribute:

span.label

Becomes:

<span class="label">|</span>

Want to add more than one class name? Try:

span.label.info

to get:

<span class="label info">|</span>

Can you guess what this would turn in to?

button.xlarge.active tabindex="2"
 
 
comments powered by Disqus