Neovim crashes when opening markdown files
TL;DR
- If Neovim crashes on
.md, check Treesitter errors in~/.local/state/nvim/log.- Disable the markdown plugin explicitly (LazyVim extras may still load it).
- If queries are stale, wipe Treesitter parsers/caches so everything reinstalls clean.
I ran into a frustrating issue where Neovim would crash immediately when opening any .md file. Even :checkhealth would crash (since it renders as markdown).
The error in ~/.local/state/nvim/log was cryptic:
The problem
Two things were going wrong:
-
render-markdown.nvim was loading even though I had it commented out. I use LazyVim with
lazyvim.plugins.extras.lang.markdown, which enables render-markdown.nvim. Commenting out a plugin spec doesn't disable plugins from LazyVim extras - you need an explicitenabled = false. -
Stale treesitter parsers. The vim parser's query files referenced a node type that didn't exist in my installed parser, causing crashes when markdown triggered vim syntax injection.
The fix
First, add an explicit disable in lua/plugins/overrides.lua:
If that doesn't work (Lazy.nvim cache can be stubborn), do a clean reinstall:
Lesson learned
When disabling plugins that come from LazyVim extras, always use explicit enabled = false. Commenting out doesn't cut it.