Neovim 0.12.3 tree-sitter Parser Error on NetBSD ================================================ .. code-block:: console Error in BufReadPost Autocommands for "*": Lua callback: /usr/pkg/share/nvim/runtime/filetype.lua:28: BufReadPost Autocommands for "*". .FileType Autocommands for "*"..function 1_LoadFTPlugin[20]..script /usr/pkg/share/nvim/runtime/ftplugin/markdown.lua: Vim(runtime):E5113: Lua chunk: /usr/pkg/share/nvim/runtime/lua/vim/treesitter.lua:460: Parser could not be created for buffer 1 and language "markdown" stack traceback: [C]: in function 'assert' /usr/pkg/share/nvim/runtime/lua/vim/treesitter.lua:460: in function 'start' /usr/pkg/share/nvim/runtime/ftplugin/markdown.lua:1: in main chunk [C]: in function 'nvim_cmd' /usr/pkg/share/nvim/runtime/filetype.lua:28: in function [C]: in function 'pcall' vim/_core/shared:1648: in function [C]: in function '_with' /usr/pkg/share/nvim/runtime/filetype.lua:27: in function stack traceback: [C]: in function '_with' /usr/pkg/share/nvim/runtime/filetype.lua:27: in function The Fix --------- From within neovim enter this command: .. code-block:: console lua require('nvim-treesitter').install({ 'lua', 'markdown', 'markdown_inline' }):wait(300000) To check enter these commands: .. code-block:: console :lua print(vim.treesitter.language.add("lua")) :lua print(vim.treesitter.language.add("markdown")) From chatGPT ------------- That confirms the real problem: you have no tree-sitter language parsers installed. So Neovim itself is fine, nvim-treesitter is present, but there is no: .. code-block:: console lua.so markdown.so markdown_inline.so anywhere under your Neovim data directory. Inside Neovim, run this exactly: .. code-block:: vim :lua require('nvim-treesitter').install({ 'lua', 'markdown', 'markdown_inline' }):wait(300000) Then check from the shell: .. code-block:: vim find ~/.local/share/nvim -type f -path '*/parser/*.so' -print You should then see something like: .. code-block:: vim /home/yourname/.local/share/nvim/site/parser/lua.so /home/yourname/.local/share/nvim/site/parser/markdown.so /home/yourname/.local/share/nvim/site/parser/markdown_inline.so After that, restart Neovim and test: .. code-block:: vim :lua print(vim.treesitter.language.add("lua")) and .. code-block:: vim :lua print(vim.treesitter.language.add("markdown")) Those should return: .. code-block:: vim true If the install command throws an error instead of installing the parsers, paste that error. On NetBSD, the next likely issue would be the parser build toolchain or tree-sitter CLI, and we can fix that directly. Neovim 0.12.3 tree-sitter Parser Error on NetBSD ------------------------------------------------- Problem ~~~~~~~ When opening Markdown (`.md`) or Lua files in Neovim on NetBSD, Neovim produced errors such as: .. code-block:: console Error in BufReadPost Autocommands Parser could not be created for buffer 1 and language "markdown" The traceback pointed into: .. code-block:: console /usr/pkg/share/nvim/runtime/ftplugin/markdown.lua /usr/pkg/share/nvim/runtime/lua/vim/treesitter.lua Neovim version: .. code-block:: console NVIM v0.12.3 Build type: Release LuaJIT 2.1.1713773202 Initial checks ~~~~~~~~~~~~~~ tree-sitter health showed no obvious problem: .. code-block:: console :checkhealth vim.treesitter However, trying to load the parsers manually showed the problem: .. code-block:: console :lua print(vim.treesitter.language.add("lua")) :lua print(vim.treesitter.language.add("markdown")) Both returned: .. code-block:: console nil Also, the normal Neovim parser directory did not exist: .. code-block:: console /usr/pkg/share/nvim/runtime/parser Checking for installed parser shared libraries: .. code-block:: console find ~/.local/share/nvim -type f -path '*/parser/*.so' -print returned nothing. This confirmed that the tree-sitter infrastructure was present, but the actual language parsers were missing. Neovim plugin configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `lazy.nvim` was already loading: .. code-block:: lua return { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", config = function() require("config.nvim-treesitter") end, } There was no need to create an additional `treesitter.lua` plugin file. Optionally, the plugin can be loaded eagerly: .. code-block:: lua return { "nvim-treesitter/nvim-treesitter", lazy = false, build = ":TSUpdate", config = function() require("config.nvim-treesitter") end, } The plugin itself being installed does not mean that language parsers are installed. Solution ~~~~~~~~~ From inside Neovim, explicitly install the needed parsers: .. code-block:: console :lua require('nvim-treesitter').install({ 'lua', 'markdown', 'markdown_inline' }):wait(300000) This installed the tree-sitter parser shared libraries. After installation, opening Lua and Markdown files worked normally. Verification ~~~~~~~~~~~~ Check that parser files now exist: .. code-block:: console find ~/.local/share/nvim -type f -path '*/parser/*.so' -print You should see files similar to: .. code-block:: console ~/.local/share/nvim/site/parser/lua.so ~/.local/share/nvim/site/parser/markdown.so ~/.local/share/nvim/site/parser/markdown_inline.so You can also verify from within Neovim: .. code-block:: console :lua print(vim.treesitter.language.add("lua")) :lua print(vim.treesitter.language.add("markdown")) These should now succeed. Root cause ~~~~~~~~~~ The `nvim-treesitter` plugin was installed, but the actual compiled tree-sitter language parsers were not. In other words: .. code-block:: console nvim-treesitter plugin installed != tree-sitter language parsers installed Neovim attempted to start tree-sitter automatically for Markdown and Lua files, but no parser `.so` files were available, causing: .. code-block:: console Parser could not be created The fix was to explicitly install the required parsers with: .. code-block:: console :lua require('nvim-treesitter').install({ 'lua', 'markdown', 'markdown_inline' }):wait(300000)