Skip to content

Latest commit

 

History

History
131 lines (101 loc) · 5.29 KB

CONFIGURATION.md

File metadata and controls

131 lines (101 loc) · 5.29 KB

Configuration

Example:

[styles.haskell]
line = ["--"]
block-begin = ["{-"]
block-end = ["-}"]
block-nesting = true
strings = [
    { begin="\"", escape="\\\"", end="\"" },
    # Note: characters must also be treated as strings
    # Note: characters could be omitted here since all
    #       comment tokens are longer than 1 character
    #       and strings only exist to not wrongly match
    #       comment tokens.
    { begin="'", escape="\\'", end="'" },
]

[extensions]
haskell = ["hs"]

[aspell-options]
lang = "en_US"
ignore-case = "true"

[general]
highlight-commands = [
    "source-highlight -f esc --style-file=esc.style -i %FILE%",
    "pygmentize %FILE%",
]
italic-to-underline = true
box-style = "heavysharp"
# Ignore PascalCase, camelCalse, snake_case, and kebab-case words as
# they're likely identifiers.
filters = [
    "^[[:upper:]]?[[:lower:]]+[[:upper:]].*$",
    "^[[:alpha:]]*[_-][[:alpha:]].*$",
]
backup = false

Sections

[styles]

Contains the comment style definitions.

[extensions]

Defines which file extension uses which comment style. The keys should be one of the names defined in the styles section.

[aspell-options]

Contains options that are forwarded to the Aspell library. See man spell for available options.

Note that the values are always strings so for a boolean use "true" instead of true.

[general]

Contains the main configuration for the program:

Key Description Default
backup Whether to generate backup files true
bottom-status Whether to show the status bar at the bottom false
box-style Which flavor of box drawing characters to use, valid values are "rounded", "sharp", "heavysharp", "double", and "ascii". An invalid value defaults to rounded. "rounded"
dim-code Whether to dim the colors of code outside comments true
filter-commented-code Whether filtering of commented code is enabled. More details about this are in the readme. false
filters A list of regular expressions, if any of them matches a word it is not checked. They use the RE2 syntax: https://golang.org/s/re2syntax (like Perl or Python). []
highlight-commands A list of commands to try for highlighting.These should produce highlighting using ANSI escape codes. In the strings %FILE% is replaced with the filename. The first highlighter that does not give an error is used. []
ignore-case Whether to ignore the case for the "Ignore all", "Replace all", and ignore lists. This does not affect the spell checking, use the ignore-case option in the aspell-options section for that. true
ignore-lists List of ignore lists [".spellcheck_comments_ignorelist"]
italic-to-underline Whether to convert the italic styles to underline in the highlighted source. This exists because some terminals don't support the italic style and treat it as reversed colors instead. false
layout The layout to use, either "aspell" or "default" (anything else defaults to "default") "default"
mouse Whether to enable mouse interaction true
suggestions The maximum number of suggestions to show 20 in default layout, 10 in Aspell layout
tab-size Width of tab characters 4

[colors]

Defines the interface colors, colors are given as ANSI escape codes:

key description default
box-outline Border colors for box drawing characters "\x1b[38;5;213m"
comment Overwrites the comment color generated by highlighters. If at least 1 highlighter is provided "", otherwise "\x1b[1;32m". If all highlighters fail the latter is used as well.
current-line-number The line number of the current line \x1b[38;5;251m
line-number All other line numbers \x1b[38;5;243m
menu The color for the suggestion menu in the default layout \x1b[48;5;61;38;5;232m
status-bar The colors for the status bar \x1b[38;5;251;7m

Comment styles

Note: tokens are limited to 8 bytes.

key description
line List of tokens that start a line comment
block-begin List of tokens that start a block comment
block-end List of tokens that end a block comment
block-nesting Whether nesting of block comments is allowed
strings List of string styles

The tokens in block-begin and block-end must match, if for example the 2nd token in block-begin is matched only the 2nd token in block-end can terminate that comment.

Strings are used so we don't accidentally match a comment token inside a string.

The parser will match a token as soon as it can so if 2 tokens start with the same substring the longer of them can never be matched. This means that strings cannot be matched in Python code as they would always steal away the token from doc-strings.

Strings

key description
begin Token that begins a string
end Token that ends a string
escape Escape token that will not end the string.

There is no special support for character literals.

Ignore lists

These are files containing 1 word per line, these words are never spell checked. If a filename is absolute is it used as-is, if it's relative it may the relative to the spellcheck_comments.toml/config.toml file and the current directory. Case sensitivity of the words is controlled by the general.ignore-case option.