From fcc6aa485cca678c063cca1b85bafe78af8d1e49 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 4 Jan 2025 15:29:11 +0300 Subject: [PATCH] utility/wakatime: move plugin options to `vim.globals`; cleanup --- modules/plugins/utility/wakatime/config.nix | 14 +++++++++----- modules/plugins/utility/wakatime/default.nix | 2 +- modules/plugins/utility/wakatime/vim-wakatime.nix | 14 ++++++++++---- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/modules/plugins/utility/wakatime/config.nix b/modules/plugins/utility/wakatime/config.nix index a1892e7b..675f0034 100644 --- a/modules/plugins/utility/wakatime/config.nix +++ b/modules/plugins/utility/wakatime/config.nix @@ -1,18 +1,22 @@ { config, - lib, pkgs, + lib, ... }: let inherit (lib.modules) mkIf; + inherit (lib.meta) getExe; cfg = config.vim.utility.vim-wakatime; in { 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) '' - vim.g.wakatime_CLIPath = "${cfg.cli-package}" - ''; + # Wakatime configuration is stored as vim globals. + globals = { + "wakatime_CLIPath" = mkIf (cfg.cli-package != null) "${getExe cfg.cli-package}"; + }; + }; }; } diff --git a/modules/plugins/utility/wakatime/default.nix b/modules/plugins/utility/wakatime/default.nix index d6d67d57..c72189d5 100644 --- a/modules/plugins/utility/wakatime/default.nix +++ b/modules/plugins/utility/wakatime/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./config.nix ./vim-wakatime.nix diff --git a/modules/plugins/utility/wakatime/vim-wakatime.nix b/modules/plugins/utility/wakatime/vim-wakatime.nix index 6b853821..04f27868 100644 --- a/modules/plugins/utility/wakatime/vim-wakatime.nix +++ b/modules/plugins/utility/wakatime/vim-wakatime.nix @@ -1,18 +1,24 @@ { - lib, pkgs, + lib, ... }: let inherit (lib.options) mkEnableOption mkOption; inherit (lib.types) nullOr package; in { 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 { type = nullOr package; - default = pkgs.wakatime; - description = "The package that should be used for wakatime-cli. Set as null to use the default path in `$XDG_DATA_HOME`"; + default = pkgs.wakatime-cli; + 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` + ''; }; }; }