By default, the Bash dictionary is only applied to files of type shellscript. This example shows how to enable the Bash dictionary for specific folders or filenames using overrides in your cspell configuration.
Note:
pre-commituses the same cspell configuration, sooverrideswork identically when running cspell viapre-commit.
Consider a project where Markdown files contain Bash code blocks. Words like esac, getopts, and shopt will be flagged as unknown because the Bash dictionary is not active for .md files by default.
Add an overrides section to your cspell.json:
{
"overrides": [
{
"filename": ["**/bash_docs/**/*.md", "**/bash_examples/**"],
"dictionaries": ["bash"]
}
],
"version": "0.2"
}With this configuration:
docs/bash_docs/pipes.md— will use the Bash dictionary (no errors for bash words)docs/about.md— will not use the Bash dictionary (bash words flagged as errors)
For a single file, use an inline directive instead of configuring overrides:
<!--- cspell:dictionaries bash --->This is useful when only one or two files need the extra dictionary.