In CotEditor, you can configure delimiter-related settings for each syntax. These settings affect editor behavior while typing and regular-expression-based syntax highlighting.
To define delimiters for a syntax, select Delimiters in the list on the left side of the syntax editor, then configure options on the right. See Define a syntax for how to open the syntax editor.
Define comment delimiters so CotEditor can use Comment Out and Uncomment for this syntax. In regular-expression-based syntax definitions, they are also used for comment highlighting.
Inline comments treat text from the Begin String to the end of the line as a comment.
| Field | Description |
|---|---|
| Begin String | Delimiter that starts an inline comment. Text from this delimiter to the end of the line is treated as a comment. |
| Line Start Only | If selected, the Begin String matches only at the start of a line (after leading spaces or tabs). |
Block comments treat text enclosed by Begin String and End String as a comment. To use block comments, set both fields.
| Field | Description |
|---|---|
| Begin String | Delimiter that starts a block comment. Text from this delimiter to the corresponding End String is treated as one comment range. |
| End String | Delimiter that ends a block comment. |
| Nest | When enabled, CotEditor resolves block comment ranges with nesting. When disabled, a block comment closes at the first matching end delimiter. |
When both inline and block comment delimiters are defined, the Comment Out command uses inline delimiters first. If multiple delimiters are defined, the first one in the list is used.
String delimiters are used to determine string ranges for the Strings element in regular-expression-based syntax highlighting. They are also used for paired-symbol matching in the editor. Text enclosed by the Begin String and End String is treated as a string.
| Field | Description |
|---|---|
| Begin String | Delimiter that starts a string. |
| End String | Delimiter that ends a string. |
| Multiline | If selected, strings can span across line breaks. |
| Escape Character | The character used to escape the end delimiter inside the string. Leave empty for no escaping. |
| Prefixes | Comma-separated list of prefix strings that must immediately precede the Begin String for the delimiter to match. For example, set |
| Description | A note for your reference (optional). |
If you define multiple string delimiters, you can support different quote styles in the same syntax (for example, "…" and """…""").
Character delimiters are used to determine character-literal ranges for the Characters element in regular-expression-based syntax highlighting. They are also used for paired-symbol matching in the editor. Text enclosed by the Begin String and End String is treated as a character literal.
| Field | Description |
|---|---|
| Begin String | Delimiter that starts a character literal. |
| End String | Delimiter that ends a character literal. |
| Escape Character | The character used to escape the end delimiter inside the character literal. Leave empty for no escaping. |
| Description | A note for your reference (optional). |
Block delimiters are used for automatic indentation while typing. When the token at the end of a line matches a Begin String, pressing Return inserts one additional indentation level on the new line.
| Field | Description |
|---|---|
| IC | Ignore case. Enable this only for case-insensitive languages. |
| Begin String | Token that starts an indentation block. |
| End String | Token that closes the block. You can leave this empty for begin-only rules (for example, a trailing |
| Description | A note for your reference (optional). |
If both Begin String and End String are set and the End String is immediately after the insertion point, CotEditor inserts an extra blank line and keeps the closing line at the original indentation level.