nix-community.nixvim/plugins/languages/vimtex.nix

42 lines
989 B
Nix
Raw Normal View History

{
pkgs,
lib,
config,
...
}: let
2023-02-14 20:48:13 +01:00
cfg = config.plugins.vimtex;
helpers = import ../helpers.nix {inherit lib;};
2023-02-14 20:48:13 +01:00
in
with lib; {
options.plugins.vimtex = {
enable = mkEnableOption "vimtex";
2023-02-14 20:48:13 +01:00
package = helpers.mkPackageOption "vimtex" pkgs.vimPlugins.vimtex;
2023-02-14 20:48:13 +01:00
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;
};
'';
};
2023-02-14 20:48:13 +01:00
config = let
globals =
{
enabled = cfg.enable;
callback_progpath = "nvim";
}
// cfg.extraConfig;
2023-02-14 20:48:13 +01:00
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
2023-02-14 20:48:13 +01:00
# Usefull for inverse search
extraPackages = with pkgs; [pstree xdotool];
2023-02-14 20:48:13 +01:00
globals = mapAttrs' (name: value: nameValuePair ("vimtex_" + name) value) globals;
};
}