Adding a new tree sitter parser to neovim

I figured it out, posting in the hope it helps someone else. Build the grammar with tree-sitter.buildGrammar and append it to your list of nvim-treesitter grammars (in my config I use nvim-treesitter.allGrammars).

{
  # in your neovim config
  plugins = with pkgs.vimPlugins; [
    # ... your other plugins
    (nvim-treesitter.withPlugins (_: nvim-treesitter.allGrammars ++ [
      (pkgs.tree-sitter.buildGrammar {
        language = "just";
        version = "8af0aab";
        src = pkgs.fetchFromGitHub {
          owner = "IndianBoy42";
          repo = "tree-sitter-just";
          rev = "8af0aab79854aaf25b620a52c39485849922f766";
          sha256 = "sha256-hYKFidN3LHJg2NLM1EiJFki+0nqi1URnoLLPknUbFJY=";
        };
      })
    ]))
  ];
}
6 Likes