diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 392d26320..dcff129d3 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -15,7 +15,7 @@ let localVarsStr = config.lib.zsh.defineAll cfg.localVariables; aliasesStr = concatStringsSep "\n" ( - mapAttrsToList (k: v: "alias ${k}=${lib.escapeShellArg v}") cfg.shellAliases + mapAttrsToList (k: v: "alias -- ${lib.escapeShellArg k}=${lib.escapeShellArg v}") cfg.shellAliases ); dirHashesStr = concatStringsSep "\n" ( @@ -637,8 +637,8 @@ in # Aliases ${aliasesStr} '' - ] - ++ (mapAttrsToList (k: v: "alias -g ${k}=${lib.escapeShellArg v}") cfg.shellGlobalAliases) + ] + ++ (mapAttrsToList (k: v: "alias -g -- ${lib.escapeShellArg k}=${lib.escapeShellArg v}") cfg.shellGlobalAliases) ++ [ ('' # Named Directory Hashes ${dirHashesStr} diff --git a/tests/modules/programs/pls/zsh.nix b/tests/modules/programs/pls/zsh.nix index f3bcbf2a8..3a27c4d3e 100644 --- a/tests/modules/programs/pls/zsh.nix +++ b/tests/modules/programs/pls/zsh.nix @@ -23,10 +23,10 @@ with lib; assertFileExists home-files/.zshrc assertFileContains \ home-files/.zshrc \ - "alias ls='@pls@/bin/pls'" + "alias -- 'ls'='@pls@/bin/pls'" assertFileContains \ home-files/.zshrc \ - "alias ll='@pls@/bin/pls -d perms -d user -d group -d size -d mtime -d git'" + "alias -- 'll'='@pls@/bin/pls -d perms -d user -d group -d size -d mtime -d git'" ''; }; }