Adds view method option to vimtex and allows the installation of texlive with the plugin (#637)

This commit is contained in:
Maximilian Ehlers 2023-10-11 12:38:06 +02:00 committed by GitHub
parent fc5bbc733c
commit c5150bfcdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,25 @@ in
''; '';
default = {}; default = {};
}; };
viewMethod = mkOption {
type = types.str;
description = ''
The view method that vimtex will use to display PDF's.
Check https://github.com/lervag/vimtex/blob/03c83443108a6984bf90100f6d00ec270b84a339/doc/vimtex.txt#L3322
for more information.
'';
default = "general";
};
installTexLive = mkOption {
type = types.bool;
description = ''
Whether or not to install TexLive.
See https://nixos.wiki/wiki/TexLive.
'';
default = false;
};
texLivePackage = helpers.mkPackageOption "texLivePackage" pkgs.texlive.combined.scheme-medium;
}; };
config = let config = let
@ -31,14 +50,26 @@ in
{ {
enabled = cfg.enable; enabled = cfg.enable;
callback_progpath = "nvim"; callback_progpath = "nvim";
view_method = cfg.viewMethod;
} }
// cfg.extraConfig; // cfg.extraConfig;
basePackages =
[pkgs.pstree]
++ (
lib.optional cfg.installTexLive cfg.texLivePackage
);
viewMethodAndPDFViewerPairs = {
general = [pkgs.xdotool];
zathura = [pkgs.xdotool pkgs.zathura];
zathura_simple = [pkgs.zathura];
mupdf = [pkgs.xdotool pkgs.mupdf];
};
in in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
# Usefull for inverse search extraPackages =
extraPackages = with pkgs; [pstree xdotool]; basePackages ++ (lib.optionals (hasAttr "${cfg.viewMethod}" viewMethodAndPDFViewerPairs) viewMethodAndPDFViewerPairs."${cfg.viewMethod}");
globals = mapAttrs' (name: nameValuePair ("vimtex_" + name)) globals; globals = mapAttrs' (name: nameValuePair ("vimtex_" + name)) globals;
}; };