nixos/shells: support defining aliases beginning with a dash or plus
Both Zsh and Bash support aliases that begin with characters also used to indicate options to the “alias” built-in command, as long as the alias definition is preceeded by a double dash. This allows, e.g, for “alias -- +x=chmod +x”.
This commit is contained in:
parent
e0e0c4dbd9
commit
5764782921
2 changed files with 2 additions and 2 deletions
|
@ -12,7 +12,7 @@ let
|
|||
cfg = config.programs.bash;
|
||||
|
||||
bashAliases = concatStringsSep "\n" (
|
||||
mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}")
|
||||
mapAttrsFlatten (k: v: "alias -- ${k}=${escapeShellArg v}")
|
||||
(filterAttrs (k: v: v != null) cfg.shellAliases)
|
||||
);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ let
|
|||
opt = options.programs.zsh;
|
||||
|
||||
zshAliases = concatStringsSep "\n" (
|
||||
mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}")
|
||||
mapAttrsFlatten (k: v: "alias -- ${k}=${escapeShellArg v}")
|
||||
(filterAttrs (k: v: v != null) cfg.shellAliases)
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue