nix-community.nixvim/plugins/by-name/vimtex/default.nix

107 lines
2.4 KiB
Nix
Raw Normal View History

{
lib,
helpers,
pkgs,
...
2024-02-13 23:16:01 +01:00
}:
with lib;
2024-12-22 09:58:27 +00:00
lib.nixvim.plugins.mkVimPlugin {
2024-05-05 19:39:35 +02:00
name = "vimtex";
globalPrefix = "vimtex_";
2023-02-14 20:48:13 +01:00
2024-05-05 19:39:35 +02:00
maintainers = [ maintainers.GaetanLepage ];
2023-02-14 20:48:13 +01:00
2024-05-05 19:39:35 +02:00
# TODO introduced 2024-02-20: remove 2024-04-20
deprecateExtraConfig = true;
optionsRenamedToSettings = [ "viewMethod" ];
imports =
let
basePluginPath = [
"plugins"
"vimtex"
];
in
[
(mkRemovedOptionModule (
basePluginPath ++ [ "installTexLive" ]
) "If you don't want `texlive` to be installed, set `plugins.vimtex.texlivePackage` to `null`.")
(mkRenamedOptionModule (basePluginPath ++ [ "texLivePackage" ]) (
basePluginPath ++ [ "texlivePackage" ]
))
2024-02-13 23:16:01 +01:00
];
2024-05-05 19:39:35 +02:00
settingsOptions = {
view_method = mkOption {
type = types.str;
default = "general";
example = "zathura";
description = ''
Set the viewer method.
By default, a generic viewer is used through the general view method (e.g. `xdg-open` on Linux).
'';
};
2024-05-05 19:39:35 +02:00
};
2023-02-14 20:48:13 +01:00
2024-05-05 19:39:35 +02:00
settingsExample = {
view_method = "zathura";
compiler_method = "latexrun";
toc_config = {
split_pos = "vert topleft";
split_width = 40;
2024-02-13 23:16:01 +01:00
};
2024-05-05 19:39:35 +02:00
};
2023-02-14 20:48:13 +01:00
2024-05-05 19:39:35 +02:00
extraOptions = {
texlivePackage = lib.mkPackageOption pkgs "texlive" {
nullable = true;
default = [
"texlive"
"combined"
"scheme-medium"
];
2024-02-13 23:16:01 +01:00
};
xdotoolPackage = lib.mkPackageOption pkgs "xdotool" {
nullable = true;
};
zathuraPackage = lib.mkPackageOption pkgs "zathura" {
nullable = true;
};
mupdfPackage = lib.mkPackageOption pkgs "mupdf" {
nullable = true;
};
pstreePackage = lib.mkPackageOption pkgs "pstree" {
nullable = true;
};
2024-05-05 19:39:35 +02:00
};
2023-02-14 20:48:13 +01:00
2024-05-05 19:39:35 +02:00
extraConfig = cfg: {
plugins.vimtex.settings = {
enabled = true;
callback_progpath = "nvim";
};
2024-02-13 23:16:01 +01:00
2024-05-05 19:39:35 +02:00
extraPackages =
let
2024-02-13 23:16:01 +01:00
# xdotool does not exist on darwin
xdotool = optional pkgs.stdenv.isLinux cfg.xdotoolPackage;
2024-02-13 23:16:01 +01:00
viewerPackages =
{
general = xdotool;
zathura = xdotool ++ [ cfg.zathuraPackage ];
zathura_simple = [ cfg.zathuraPackage ];
mupdf = xdotool ++ [ cfg.mupdfPackage ];
2024-02-13 23:16:01 +01:00
}
2024-05-05 19:39:35 +02:00
.${cfg.settings.view_method} or [ ];
2024-02-13 23:16:01 +01:00
in
[
cfg.pstreePackage
cfg.texlivePackage
]
++ viewerPackages;
2024-05-05 19:39:35 +02:00
};
}