Saving Code Blocks as Snippets

With code snippets, you can easily store code blocks and content for reuse. Comment your snippets just as you would any code block.

To create a code snippet:

  1. Before adding a snippet, you must create a folder. To do so, click the Snippets tab in the Resources window, right-click in the Snippets panel, and select Create Folder from the menu.


    You can create additional folders as needed. The default location for snippets is the \UserData\Snippets folder below your root directory.

  2. Enter a name for the folder.
  3. Right-click in the Snippets pane and select Add Snippet to open the Snippet dialog box.
  4. Enter a name for the snippet in the Description box. Note that snippet names cannot contain characters that are illegal in file names, such as slashes, special characters, or double quotes.
  5. In the Start Text window, type or paste an opening code block. You can set a default spacing between the blocks by pressing the Enter key at the end of the start text and at the beginning of the end text.
  6. In the End Text window, enter a closing code block.
  7. Click OK.


Because snippets can be created as start and end blocks, you can use them to surround other tags and content. This is handy for inserting special formatting, navigation elements, and script blocks. Simply highlight the content you want to surround, then insert the snippet.

To insert a code snippet, do one of the following:

To edit or delete a code snippet:

To manage code snippets and snippet folders:

Sharing snippets

You can share code snippets with other developers by giving them access to a shared folder on your machine or on another network machine.

To create a shared snippets folder:

  1. Open Options > Settings > Locations.
  2. In the Shared Snippets box, use the Browse button to navigate to the shared folder location and click OK.
  3. In the Snippets panel, right-click and select Create Shared Folder.

    The folder button changes color to show that it is shared.

Anyone with access to the shared folder can now add, edit, and delete snippets.

Adding snippet shortcut keys

Open the Options > Customize dialog box and select the Snippet Shortcuts tab to enable a keyboard combination for a snippet. Select a snippet and press keys to enter the combination in the box at the bottom.

If a combination is in use, the current command appears below the shortcut box. To overwrite a combination, click Apply.