From c8cd8b44fff483aa2ca33ce47885c8335a92dae3 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Fri, 26 Jan 2024 21:18:16 +0800 Subject: [PATCH] nixvimConfigs/fiesta/setups/treesitter: init --- configs/nixvim/fiesta/default.nix | 1 + configs/nixvim/fiesta/modules/default.nix | 1 + .../fiesta/modules/setups/treesitter.nix | 38 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 configs/nixvim/fiesta/modules/setups/treesitter.nix diff --git a/configs/nixvim/fiesta/default.nix b/configs/nixvim/fiesta/default.nix index 3580a812..babf1f6b 100644 --- a/configs/nixvim/fiesta/default.nix +++ b/configs/nixvim/fiesta/default.nix @@ -5,6 +5,7 @@ imports = [ ./modules ]; nixvimConfigs.fiesta.setups = { + treesitter.enable = true; desktop-utils.enable = true; }; diff --git a/configs/nixvim/fiesta/modules/default.nix b/configs/nixvim/fiesta/modules/default.nix index 100c01c6..78683f36 100644 --- a/configs/nixvim/fiesta/modules/default.nix +++ b/configs/nixvim/fiesta/modules/default.nix @@ -1,5 +1,6 @@ { imports = [ ./setups/desktop-utils.nix + ./setups/treesitter.nix ]; } diff --git a/configs/nixvim/fiesta/modules/setups/treesitter.nix b/configs/nixvim/fiesta/modules/setups/treesitter.nix new file mode 100644 index 00000000..3914037e --- /dev/null +++ b/configs/nixvim/fiesta/modules/setups/treesitter.nix @@ -0,0 +1,38 @@ +{ config, lib, pkgs, ... }: + +let + nixvimCfg = config.nixvimConfigs.fiesta; + cfg = nixvimCfg.setups.treesitter; +in +{ + options.nixvimConfigs.fiesta.setups.treesitter.enable = + lib.mkEnableOption "tree-sitter setup for Fiesta NixVim"; + + config = lib.mkIf cfg.enable { + # The main star of the show. + plugins.treesitter = { + enable = true; + + # Install all of the grammars with Nix. We can easily replace it if we + # want to. + nixGrammars = true; + ensureInstalled = "all"; + + # Enable all of its useful features. + folding = true; + indent = true; + }; + + # Enable some more context for me. + plugins.treesitter-context = { + enable = true; + lineNumbers = true; + maxLines = 10; + }; + + # Show me your moves. + plugins.treesitter-textobjects = { + enable = true; + }; + }; +}