From 23604dd5b0c436a954fd5c95b704501319b86c9d Mon Sep 17 00:00:00 2001 From: Alexander Nortung Date: Tue, 17 Jan 2023 21:54:15 +0100 Subject: [PATCH] treesitter: package option --- plugins/languages/treesitter.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/languages/treesitter.nix b/plugins/languages/treesitter.nix index 8539af81..eb3f13c6 100644 --- a/plugins/languages/treesitter.nix +++ b/plugins/languages/treesitter.nix @@ -9,6 +9,12 @@ in plugins.treesitter = { enable = mkEnableOption "Enable tree-sitter syntax highlighting"; + package = mkOption { + type = types.package; + default = pkgs.vimPlugins.nvim-treesitter; + description = "Plugin to use for nvim-treesitter. If using nixGrammars, it should include a `withPlugins` function"; + }; + nixGrammars = mkOption { type = types.bool; default = true; @@ -126,8 +132,8 @@ in ''; extraPlugins = with pkgs; if cfg.nixGrammars then - [ (vimPlugins.nvim-treesitter.withPlugins (_: cfg.grammarPackages)) ] - else [ vimPlugins.nvim-treesitter ]; + [ (cfg.package.withPlugins (_: cfg.grammarPackages)) ] + else [ cfg.package ]; extraPackages = [ pkgs.tree-sitter pkgs.nodejs ]; options = mkIf cfg.folding {