36 lines
701 B
Nix
36 lines
701 B
Nix
{ lib
|
|
, nvim-treesitter
|
|
, tree-sitter
|
|
, grammarFileTypes
|
|
, ...
|
|
}:
|
|
|
|
|
|
let
|
|
inherit (builtins) readFile;
|
|
|
|
extraGrammars = {
|
|
tree-sitter-org = lib.importJSON ./tree-sitter-org-nvim.json // { language = "org"; };
|
|
};
|
|
|
|
extended-treesitter = tree-sitter.override { inherit extraGrammars; };
|
|
|
|
treeSitterGrammars = extended-treesitter.withPlugins (
|
|
grammars: map (ft: grammars."tree-sitter-${ft}") grammarFileTypes
|
|
);
|
|
|
|
nvim-treesitter-with-grammars = nvim-treesitter.overrideAttrs (oldAttrs: {
|
|
postPatch = ''
|
|
rm -r parser
|
|
ln -s ${treeSitterGrammars} parser
|
|
'';
|
|
});
|
|
|
|
in
|
|
{
|
|
luaConfig = readFile ./treesitter.lua;
|
|
|
|
plugins = [
|
|
nvim-treesitter-with-grammars
|
|
];
|
|
}
|