plugins: add vimtex

This commit is contained in:
Gaetan Lepage 2023-01-24 14:54:37 +01:00
parent c73bef16ab
commit c78a86d55e
2 changed files with 43 additions and 0 deletions

View file

@ -28,6 +28,7 @@
./languages/treesitter.nix
./languages/treesitter-context.nix
./languages/treesitter-refactor.nix
./languages/vimtex.nix
./languages/zig.nix
./null-ls

View file

@ -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;
};
}