Insert a snippet in CotEditor on Mac

You can register frequently used pieces of text (snippets) and insert them easily as needed.

CotEditor provides two types of snippets: Command snippets and File Drop snippets, which differ in how they are inserted.

To configure both types of snippet, choose CotEditor > Settings, then click Snippets.

Insert a snippet using a command

Command snippets are snippets that you insert from a menu or by using keyboard shortcuts. You can also insert text so that it surrounds the currently selected text, or specify the position of the insertion point after insertion.

  1. In the CotEditor app on your Mac, open a document.

  2. Do one of the following:

    • Choose Text > Insert Snippet, then choose the snippet you want to insert.

    • Press the keyboard shortcut assigned to the snippet.

Tip: If a syntax is assigned to a snippet, the snippet appears in the menu and its keyboard shortcut is available only when the current document’s syntax matches the assigned syntax. You can use this to change which snippets are available depending on the document’s syntax.

Insert a snippet by dropping files

File Drop snippets are snippets that you insert by dropping files into the editor. Depending on the file type, predefined text is inserted at the drop location. For example, you can insert an img element tag by dropping an image file from the Finder into an HTML document.

  1. In the CotEditor app on your Mac, open a document.

  2. Drop a file from another app, such as Finder, onto the location in the editor where you want to insert the snippet.

    Note: If there is no matching File Drop rule, the full path of the dropped file is inserted.

See also