utility/wakatime: move plugin options to vim.globals; cleanup

This commit is contained in:
NotAShelf 2025-01-04 15:29:11 +03:00
parent e614860a12
commit fcc6aa485c
No known key found for this signature in database
GPG key ID: EED98D11B85A2819
3 changed files with 20 additions and 10 deletions

View file

@ -1,18 +1,22 @@
{ {
config, config,
lib,
pkgs, pkgs,
lib,
... ...
}: let }: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.meta) getExe;
cfg = config.vim.utility.vim-wakatime; cfg = config.vim.utility.vim-wakatime;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim.startPlugins = [pkgs.vimPlugins.vim-wakatime]; vim = {
startPlugins = [pkgs.vimPlugins.vim-wakatime];
vim.pluginRC.vim-wakatime = mkIf (cfg.cli-package != null) '' # Wakatime configuration is stored as vim globals.
vim.g.wakatime_CLIPath = "${cfg.cli-package}" globals = {
''; "wakatime_CLIPath" = mkIf (cfg.cli-package != null) "${getExe cfg.cli-package}";
};
};
}; };
} }

View file

@ -1,4 +1,4 @@
_: { {
imports = [ imports = [
./config.nix ./config.nix
./vim-wakatime.nix ./vim-wakatime.nix

View file

@ -1,18 +1,24 @@
{ {
lib,
pkgs, pkgs,
lib,
... ...
}: let }: let
inherit (lib.options) mkEnableOption mkOption; inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) nullOr package; inherit (lib.types) nullOr package;
in { in {
options.vim.utility.vim-wakatime = { options.vim.utility.vim-wakatime = {
enable = mkEnableOption "vim-wakatime: live code statistics"; enable = mkEnableOption ''
automatic time tracking and metrics generated from your programming activity [vim-wakatime]
'';
cli-package = mkOption { cli-package = mkOption {
type = nullOr package; type = nullOr package;
default = pkgs.wakatime; default = pkgs.wakatime-cli;
description = "The package that should be used for wakatime-cli. Set as null to use the default path in `$XDG_DATA_HOME`"; example = null;
description = ''
The package that should be used for wakatime-cli.
Set as null to use the default path in {env}`$XDG_DATA_HOME`
'';
}; };
}; };
} }