1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-26 19:59:47 +01:00
home-manager/modules/programs/zsh/zsh-abbr.nix

43 lines
1.1 KiB
Nix
Raw Normal View History

2023-10-03 02:34:46 +02:00
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.programs.zsh.zsh-abbr;
in {
meta.maintainers = [ hm.maintainers.ilaumjd ];
options.programs.zsh.zsh-abbr = {
enable =
mkEnableOption "zsh-abbr - zsh manager for auto-expanding abbreviations";
2024-12-01 18:23:18 +01:00
package = mkPackageOption pkgs "zsh-abbr" { };
2023-10-03 02:34:46 +02:00
abbreviations = mkOption {
type = types.attrsOf types.str;
default = { };
example = {
l = "less";
gco = "git checkout";
};
description = ''
An attribute set that maps aliases (the top level attribute names
in this option) to abbreviations. Abbreviations are expanded with
the longer phrase after they are entered.
'';
};
};
config = mkIf cfg.enable {
programs.zsh.plugins = [{
name = "zsh-abbr";
2024-12-01 18:23:18 +01:00
src = cfg.package;
2024-11-18 00:44:26 +01:00
file = "share/zsh/zsh-abbr/zsh-abbr.plugin.zsh";
2023-10-03 02:34:46 +02:00
}];
xdg.configFile = {
"zsh-abbr/user-abbreviations".text = concatStringsSep "\n"
(mapAttrsToList (k: v: "abbr ${escapeShellArg k}=${escapeShellArg v}")
cfg.abbreviations) + "\n";
};
};
}