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

87 lines
2 KiB
Nix
Raw Normal View History

{
lib,
helpers,
config,
pkgs,
...
2024-02-13 23:16:01 +01:00
}:
with lib;
2024-05-05 19:39:35 +02:00
helpers.vim-plugin.mkVimPlugin config {
name = "vimtex";
defaultPackage = pkgs.vimPlugins.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
extraPackages = [ pkgs.pstree ];
2024-02-13 23:16:01 +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 = helpers.mkPackageOption {
name = "texlive";
2024-05-05 19:39:35 +02:00
default = pkgs.texlive.combined.scheme-medium;
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
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 pkgs.xdotool;
viewerPackages =
{
general = xdotool;
2024-05-05 19:39:35 +02:00
zathura = xdotool ++ [ pkgs.zathura ];
zathura_simple = [ pkgs.zathura ];
mupdf = xdotool ++ [ pkgs.mupdf ];
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
2024-05-05 19:39:35 +02:00
[ cfg.texlivePackage ] ++ viewerPackages;
};
}