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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

86 lines
2 KiB
Nix
Raw Normal View History

{
lib,
helpers,
pkgs,
...
2024-02-13 23:16:01 +01:00
}:
with lib;
helpers.vim-plugin.mkVimPlugin {
2024-02-13 23:16:01 +01:00
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).
'';
};
2024-05-05 19:39:35 +02:00
};
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-05-05 19:39:35 +02:00
};
2023-02-14 20:48:13 +01:00
2024-02-13 23:16:01 +01:00
extraOptions = {
texlivePackage = helpers.mkPackageOption {
name = "texlive";
2024-02-13 23:16:01 +01:00
default = pkgs.texlive.combined.scheme-medium;
};
2024-05-05 19:39:35 +02:00
};
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
[ cfg.texlivePackage ] ++ viewerPackages;
};
}