diff --git a/plugins/languages/treesitter.nix b/plugins/languages/treesitter.nix index 439f7898..5e68f1b2 100644 --- a/plugins/languages/treesitter.nix +++ b/plugins/languages/treesitter.nix @@ -9,6 +9,11 @@ in programs.nixvim.plugins.treesitter = { enable = mkEnableOption "Enable tree-sitter syntax highlighting"; + nixGrammars = mkOption { + type = types.bool; + default = false; + description = "Install grammars with Nix (beta)"; + }; ensureInstalled = mkOption { type = with types; oneOf [ (enum [ "all" "maintained" ]) (listOf str) ]; default = "maintained"; @@ -79,7 +84,9 @@ in require('nvim-treesitter.configs').setup(${helpers.toLuaObject tsOptions}) ''; - extraPlugins = [ pkgs.vimPlugins.nvim-treesitter ]; + extraPlugins = with pkgs; if cfg.nixGrammars then + [ (vimPlugins.nvim-treesitter.withPlugins(_: tree-sitter.allGrammars)) ] + else [ vimPlugins.nvim-treesitter ]; extraPackages = [ pkgs.tree-sitter pkgs.nodejs ]; options = mkIf cfg.folding {