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

96 lines
2.3 KiB
Nix
Raw Normal View History

{
lib,
helpers,
config,
pkgs,
...
2024-02-13 23:16:01 +01:00
}:
with lib;
helpers.vim-plugin.mkVimPlugin config {
name = "vimtex";
defaultPackage = pkgs.vimPlugins.vimtex;
globalPrefix = "vimtex_";
2023-02-14 20:48:13 +01:00
2024-02-13 23:16:01 +01:00
maintainers = [maintainers.GaetanLepage];
2023-02-14 20:48:13 +01:00
2024-02-13 23:16:01 +01:00
extraPackages = [pkgs.pstree];
# 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
settingsOptions = {
view_method = mkOption {
type = types.str;
default = "general";
2024-02-13 23:16:01 +01:00
example = "zathura";
description = ''
2024-02-13 23:16:01 +01:00
Set the viewer method.
By default, a generic viewer is used through the general view method (e.g. `xdg-open` on Linux).
'';
};
};
2023-02-14 20:48:13 +01:00
2024-02-13 23:16:01 +01: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
};
2023-02-14 20:48:13 +01:00
2024-02-13 23:16:01 +01:00
extraOptions = {
texlivePackage = mkOption {
type = with types; nullOr package;
default = pkgs.texlive.combined.scheme-medium;
example = null;
description = ''
The package to install for `textlive.
Set to `null` for not installing `texlive` at all.
'';
};
};
2023-02-14 20:48:13 +01:00
2024-02-13 23:16:01 +01:00
extraConfig = cfg: {
plugins.vimtex.settings = {
enabled = true;
callback_progpath = "nvim";
};
2024-02-13 23:16:01 +01:00
extraPackages = let
# xdotool does not exist on darwin
xdotool = optional pkgs.stdenv.isLinux pkgs.xdotool;
viewerPackages =
{
general = xdotool;
zathura = xdotool ++ [pkgs.zathura];
zathura_simple = [pkgs.zathura];
mupdf = xdotool ++ [pkgs.mupdf];
}
.${cfg.settings.view_method}
or [];
in
2024-04-23 16:41:27 +02:00
[
2024-02-13 23:16:01 +01:00
cfg.texlivePackage
2024-04-23 16:41:27 +02:00
]
2024-02-13 23:16:01 +01:00
++ viewerPackages;
};
}