Speed up editing with custom actions

February 28th, 2008 by HTML-Kit Support      Tags: HTML-Kit Tools       Views: 6432
VN:F [1.7.3_972]
Rating: 0.0/5 (0 votes cast)
 

With the help of HTML-Kit Tools‘ plugin managers, custom actions can be created and installed all without leaving the editor. These custom actions can add snippets, templates, right click items, keyboard shortcuts and other types of commands to speed up daily tasks.

Adding a snippet, the easy way

To create a new snippet, select the text that should be in the snippet and press Ctrl+Shift+T (or select "File > Insert > Add New Snippet" from the main menu). Type a name for the snippet in the "Title" field and click "OK."

To use the newly added snippet, press Ctrl+Shift+I ("File > Insert > Insert Snippet"). Optionally, the Snippet Window can be kept open to gain faster access to snippets ("File > Insert > Snippet Window").

Adding snippets with additional options

Although there are easier ways of adding snippets, some of the more advanced options are only available through the Plugin Manager. Once you get the hang of it, the few extra steps required to open the Plugin Manager should balance out by the other conveniences.

From the main menu, select "File > Insert > Edit and Manage Snippets." A Plugin Manager, or a Snippet Manager in this particular case, will open up. This dialog can be used to edit existing items and add new items.

Adding items in Plugin Manager

To add an item, click the "New" button. Fill in the required fields and click "OK." Once the item has been added, its content will be displayed on the right hand corner window. You can make changes and save them simply by editing the content.

Introducing text blocks

HTML-Kit Tools introduces "text blocks" to make it easier to manage plugin actions. These blocks are marked by "begin-text" and "end-text" lines, for example:


#@begin-text "default"
...
#@end-text "default"

This particular text block is labeled "default." Many plugin types use similar text blocks to contain information about various actions performed by plugins. Unless noted otherwise, the label "default" should be used because most plugins look for a default block.

What a plugin does with a text block depends on the plugin type. For example, in a snippet (a type of plugin), the default text block contains the text or the code that’s inserted by the snippet.

A simple text block

When the following text block appears in a snippet (or other type of plugin that insert text/code), the text "hello, world!" becomes the text that gets inserted:


#@begin-text "default"
hello, world!
#@end-text "default"

You can just as easily insert multiple lines of tags:


#@begin-text "default"
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>

#@end-text "default"

Using the selected text

Often it’s useful to include the selected text as part of a snippet. You can do this by including the "{{SELTEXT}}" field and enabling the "useseltext" option as follows:


#@begin-text "default" [useseltext=1]
<li>{{SELTEXT}}</li>
#@end-text "default"

If you select some text before invoking this snippet, the final result becomes "<li>selected text</li>"

Moving the cursor

Need to place the cursor at a specific point in the text? Here’s how:


#@begin-text "default" [useseltext=1, movecursor=1]
<li>{{SELTEXT}}|</li>
#@end-text "default"

Enable the "movecursor" option and place the "|" (caret character without quotes) where the cursor should appear.

Prompting for user input

The new plugins interface in HTML-Kit Tools simplifies access to more advanced features. Let’s say you have a snippet that could benefit from having an input box. It’s as easy as adding a custom input field:

#@begin-text "default" [fields=1]
My name is: {{MyName}}
#@end-text "default"

In this example "{{MyName}}" is a custom field. When the snippet is invoked, HTML-Kit Tools prompts the user to fill in a field labeled "MyName." The entered value is then inserted in the snippet.

Here’s another example, this time with multiple custom fields:

#@begin-text "default" [fields=2]
My name is: {{FirstName}} {{LastName}}
#@end-text "default"

Want to use a custom field multiple times? Simply duplicate that field and HTML-Kit will only prompt for it once:

#@begin-text "default" [fields=2]
{{SomeNumber}} * 1 is
{{SomeNumber}}.
#@end-text "default"

Conclusion

This article touches on the basics of creating custom actions in HTML-Kit Tools. You can use these custom actions to speed up adding and editing tags.

Don’t forget that these custom actions aren’t limited to snippets. You can add your own actions in other areas as well, including these commonly used features:

Snippets
"File > Insert > Edit"
Templates
"File > New > Edit"
Right Click Menu / Editor Context Menu
"Right click in editor > Extra > Edit"
Shorthand
"Tools > Shorthand > Edit" Enter custom text inside "begin-s" and "end-s"
Keyboard Shortcuts
"Tools > Keyboard Shortcuts > Edit" Enter custom text inside "begin-shortcut" and "end-shortcut"
Context Keys
"Tools > Context Keys > Edit"
Project Items
"Right click project item > Insert in Editor > Edit"
"default"
Was this article helpful?
This did not answer my questionThis answered my question (+11 rating, 8 votes)
Loading ... Loading ...
Share this on:
  • Twitter
  • Digg
  • StumbleUpon
  • Facebook
  • MySpace
  • del.icio.us
  • Sphinn
  • LinkedIn
  • Google Bookmarks
  • Live
  • Yahoo! Buzz
  • email
  • Print
 

19 Responses to “Speed up editing with custom actions”

  1. stuart says:

    pint@surf.reformism” rel=”nofollow”>.…

    спасибо за инфу!…

  2. Andrew says:

    ilona@lynn.fleshy” rel=”nofollow”>.…

    благодарю….

  3. Lee says:

    letterhead@antoine.oh” rel=”nofollow”>.…

    благодарствую….

  4. Eugene says:

    meltzer@navigable.taxied” rel=”nofollow”>.…

    благодарен!…

  5. marion says:

    appropriately@carvings.glees” rel=”nofollow”>.…

    good info….

  6. Timothy says:

    greenness@dislocated.hun” rel=”nofollow”>.…

    ñïñ….

  7. Martin says:

    binoculars@administrators.cohorts” rel=”nofollow”>.…

    tnx for info!…

  8. rick says:

    amicably@rioting.gunpowder” rel=”nofollow”>.…

    tnx for info!…

  9. Christopher says:

    ballad@reactor.lisa” rel=”nofollow”>.…

    good!!…

  10. richard says:

    vagueness@jakes.sleepy” rel=”nofollow”>.…

    tnx for info!…

  11. Ian says:

    shun@matching.colonnade” rel=”nofollow”>.…

    ñïñ!!…

  12. Cory says:

    repertoire@otter.semesters” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…

  13. daniel says:

    actuality@shred.biblical” rel=”nofollow”>.…

    tnx for info….

  14. Francisco says:

    seamen@bully.fronting” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  15. Christian says:

    reverdy@correggio.buffoon” rel=”nofollow”>.…

    tnx!!…

  16. tom says:

    stabilizing@yelps.richer” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  17. Raul says:

    nodules@newborn.epigenetic” rel=”nofollow”>.…

    áëàãîäàðþ….

  18. dave says:

    francaise@thurbers.weight” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!…

  19. luis says:

    shoup@discussion.undetermined” rel=”nofollow”>.…

    good info!…

Do you have a question that requires a reply? Please post it here for a timely and friendly reply.
 
If you have a comment, you can post it below. Not all comments are read, so be sure to use the support forum instead if you need an answer.
 
Leave a Comment or use the support forum if you have a question.

 

© 2009 HTML-Kit.com. All Rights Reserved.  |  Privacy Statement   
HTML design aid