Treesitter
Blak uses the main branch of nvim-treesitter — its installer API downloads and builds language grammars; Neovim provides highlighting.
Setup: lua/blak/core/treesitter.lua. Spec: lua/blak/plugins/editor.lua.
Default parsers
Section titled “Default parsers”treesitter = { ensure_installed = { "bash", "c", "diff", "html", "json", "lua", "luadoc", "markdown", "markdown_inline", "query", "regex", "toml", "vim", "vimdoc", "yaml", },}Language extras add to this list automatically:
| Extra | Adds |
|---|---|
lang.typescript |
javascript, typescript, tsx, jsdoc, json |
lang.typescript-tsgo |
javascript, typescript, tsx, jsdoc, json |
lang.python |
python |
lang.python-pro |
python, requirements |
lang.rust |
rust, toml |
lang.go |
go, gomod, gosum, gowork |
lang.markdown |
markdown, markdown_inline |
.jsonc files reuse the json parser — nvim-treesitter no longer ships a
separate jsonc grammar — so JSONC highlighting works without its own parser.
Installing parsers
Section titled “Installing parsers”:BlakTreesitterInstallCalls nvim-treesitter.install() with your merged list and notifies on completion. The compile step needs a C compiler and tree-sitter on $PATH — Blak ships tree-sitter-cli in the default Mason set, so on a first launch :BlakToolsInstall followed by :BlakTreesitterInstall is enough.
You can also install one parser at a time:
:lua require("nvim-treesitter").install({ "zig" })Per-buffer activation
Section titled “Per-buffer activation”Treesitter only starts on a buffer when:
- Its
filetypehas an installed parser. - Its line count is at most
performance.max_treesitter_lines(default10000).
The check happens on FileType:
-- lua/blak/core/treesitter.lua, abbreviatedvim.api.nvim_create_autocmd("FileType", { callback = function(args) if vim.api.nvim_buf_line_count(args.buf) > max_lines then return end if pcall(vim.treesitter.start, args.buf) then vim.bo[args.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end end,})So opening a 200k-line log file won’t grind to a halt — treesitter just doesn’t attach.
Tuning the line cap
Section titled “Tuning the line cap”return { performance = { max_treesitter_lines = 25000, },}Adding a parser permanently
Section titled “Adding a parser permanently”Either in user.lua:
return { treesitter = { ensure_installed = { "bash", "lua", "zig", "yaml" }, },}Lists are replaced wholesale — write out everything you want, or add it via an extra so the merge is additive.
Or as an extra:
-- lua/blak/extras/lang/zig.luareturn { id = "lang.zig", label = "Zig", treesitter = { "zig" }, mason = { "zls" }, lsp = { servers = { zls = {} } },}Indent
Section titled “Indent”Blak sets indentexpr to nvim-treesitter’s indent function on every buffer that gets a parser. If you want a language-specific indent, override via filetype autocmd in user.lua.
Inspecting
Section titled “Inspecting”:checkhealth nvim-treesitter " native checker:Inspect " show the tree at cursor:InspectTree " open the parse tree