Skip to content

Hotspots

erinata edited this page Apr 22, 2012 · 14 revisions

The simpliest snippets contain only plain text. However, you can put Hotspots inside your snippets.

For example, if you create a snippet:

Snippet Content:

<body>
    <h1>$[![]!]</h1>
    <p>$[![]!]</p>
</body>

The two $[![]!] are Hotspots. When you trigger this snippet. The caret will go to the first hotspot and stay at the <h1> tag

<body>
    <h1></h1>
    <p>$[![]!]</p>
</body>

Here you can type some text. Say you type This is section one and hit [tab] , the caret will navigate to next hotspot, which is at the <p> tag:

<body>
    <h1>This is section one</h1>
    <p></p>
</body>

And you can continue to type in the <p> tag.

You can have as many hotspots in the snippet as you like. You can put a default value inside hotspots. For example:

Snippet Content:

<body>
    <h1>$[![Default Heading Text]!]</h1>
    <p>$[![]!]</p>
</body>

When you trigger this snippet, the selection will be at the phrase Default Heading Text. If you type in some text, what you type will become the text in the <h1> tag. However, if you type nothing and hit [tab] again, the caret will navigate to the <p> tag and leave the default value Default Heading Text in place:

<body>
    <h1>Default Heading Text</h1>
    <p>$[![]!]</p>
</body>

This is very useful when you have some sensible defaults in your snippets. User and just hit [tab] to trigger the snippets and hit [tab] for several times to accept the defaults.

Back to Main Page