diff --git a/plugins/default.nix b/plugins/default.nix index d71bd429..25e901b6 100644 --- a/plugins/default.nix +++ b/plugins/default.nix @@ -30,6 +30,7 @@ ./languages/treesitter.nix ./languages/treesitter-context.nix ./languages/treesitter-refactor.nix + ./languages/vimtex.nix ./languages/zig.nix ./null-ls diff --git a/plugins/languages/vimtex.nix b/plugins/languages/vimtex.nix new file mode 100644 index 00000000..169c305a --- /dev/null +++ b/plugins/languages/vimtex.nix @@ -0,0 +1,42 @@ +{ pkgs +, lib +, config +, ... +}: +let + cfg = config.plugins.vimtex; + helpers = import ../helpers.nix { inherit lib; }; +in +with lib; +{ + options.plugins.vimtex = { + + enable = mkEnableOption "vimtex"; + + package = helpers.mkPackageOption "vimtex" pkgs.vimPlugins.vimtex; + + extraConfig = helpers.mkNullOrOption types.attrs '' + The configuration options for vimtex without the 'vimtex_' prefix. + Example: To set 'vimtex_compiler_enabled' to 1, write + extraConfig = { + compiler_enabled = true; + }; + ''; + }; + + config = + let + globals = { + enabled = cfg.enable; + } // cfg.extraConfig; + in + mkIf cfg.enable { + + extraPlugins = [ cfg.package ]; + + # Usefull for inverse search + extraPackages = with pkgs; [ pstree xdotool ]; + + globals = mapAttrs' (name: value: nameValuePair ("vimtex_" + name) value) globals; + }; +}