How to disable tree-sitter in Neovim
Tue 25 August 2026 — download

Tree-sitter is the current hot cool thing to parse languages, and is thus used by hipster editors like emacs, Neovim, helix and zed. It works by evaluating a per-language JavaScript grammar.js file (looking like this for the C language, twice as long as vim regex-based one), converting it to a JSON file by using NodeJS. The JSON is then parsed by the tree-sitter Rust binary, to spit a .c file that can then be compiled into a static library, that can then be used to parse the target language. Which is a great way to introduce horrible supply-chain issues into your code editor. Look at the amount of grammars helix is shipping from ~random GitHub repositories. On my fedora, the helix-grammar package is weighting 195.0MiB. In exchange, your editor is getting a better semantic understanding of the code, allowing precise highlighting, and syntax-based manipulations for motions and selection, enabling macros like "select all functions in this file not starting with a capital letter, and mark them as private" without resorting to terrible regex-fu.

Anyway, I'm using Neovim most of the time, and I don't like that it's using tree-sitter. Even if the grammars weren't static libraries eating disk space and another infection vector for the Shai-Hulud/North Korea/Jia Tan hack waiting to happen, the Neovim integration is a tad clunky on the file types that I'm editing: it's slow (but it's asynchronous, wow!) and is weaker than the native highlighting on markdown. I don't care about precise highlighting, the classic regex-based one is usually good enough in every dimension, and I don't use syntax-based manipulation, only text-one.

To disable tree-sitter, currently one can:

  1. Use an autocmd with something horrible like autocmd BufEnter,BufWinEnter,BufNew,FileType,BufReadPost * call v:lua.vim.treesitter.stop(str2nr(expand('<abuf>'))), but it doesn't prevent tree-sitter from running in the first place before being reverted.
  2. Override Neovim's tree-sitter start function with lua vim.treesitter.start = function() end, which will prevent tree-sitter from running, but there is no guarantee that this won't break at the next upgrade or make whatever plugin choke as this is changing a public Neovim API.

I sent a pull-request upstream to add a way to properly disable tree-sitter, but it was rejected, sigh.