This command initializes a configuration file for the Tree-sitter CLI.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tree-sitter/tree-sitter/llms.txt
Use this file to discover all available pages before exploring further.
Configuration File Location
The configuration file is created in the “default” location for your platform:- Unix:
$XDG_CONFIG_HOME/tree-sitter/config.jsonor$HOME/.config/tree-sitter/config.json - Windows:
%APPDATA%\tree-sitter\config.jsonor$HOME\AppData\Roaming\tree-sitter\config.json
The CLI will work without a config file, falling back on default values for each configuration option.
Configuration Options
The configuration file is a JSON file with the following fields:parser-directories
Specifies where to look for Tree-sitter grammars on your filesystem. Thetree-sitter highlight command uses this to automatically determine which language to use.
tree-sitter- will be treated as a Tree-sitter grammar repository.
theme
Defines colors for syntax highlighting. The Tree-sitter highlighting system annotates code with logical “highlight names” likefunction.method, type.builtin, keyword, etc.
The theme value is an object whose keys are dot-separated highlight names and values are styling parameters.
Highlight Names
A theme can contain multiple keys that share a common subsequence:variableandvariable.parameterfunction,function.builtin, andfunction.method
function.builtin.static would match function.builtin rather than function.
Styling Values
Values can be:- Integers from 0 to 255 (ANSI terminal color IDs)
- Hex strings like
"#e45649"(RGB colors) - Color names like
"red","black","purple","cyan" - Objects with keys:
color- Integer or string as aboveunderline- Booleanitalic- Booleanbold- Boolean
Example Theme
parse-theme
Controls colors for the pretty-printed CST output fromtree-sitter parse with the -c/--cst option.
Omitting a field will cause the relevant text to be rendered with its default color.
[r, g, b] with values 0-255.