mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
zsh: fix concatenation of aliases and global aliases (#6698)
Accidentally bump the lines against each other. Adding a newline to move global aliases to another line when you have both.
This commit is contained in:
parent
c4d5d72805
commit
869f2ec2ad
3 changed files with 62 additions and 8 deletions
|
|
@ -732,10 +732,11 @@ in
|
||||||
|
|
||||||
(lib.mkIf (aliasesStr != "" || cfg.shellGlobalAliases != {}) (mkOrder 1100
|
(lib.mkIf (aliasesStr != "" || cfg.shellGlobalAliases != {}) (mkOrder 1100
|
||||||
((optionalString (aliasesStr != "") aliasesStr) +
|
((optionalString (aliasesStr != "") aliasesStr) +
|
||||||
(optionalString (cfg.shellGlobalAliases != {})
|
(optionalString (cfg.shellGlobalAliases != {})
|
||||||
|
(optionalString (cfg.shellAliases != {}) "\n" +
|
||||||
(concatStringsSep "\n" (lib.mapAttrsToList
|
(concatStringsSep "\n" (lib.mapAttrsToList
|
||||||
(k: v: "alias -g -- ${lib.escapeShellArg k}=${lib.escapeShellArg v}")
|
(k: v: "alias -g -- ${lib.escapeShellArg k}=${lib.escapeShellArg v}")
|
||||||
cfg.shellGlobalAliases))))))
|
cfg.shellGlobalAliases)))))))
|
||||||
|
|
||||||
(lib.mkIf (dirHashesStr != "") (mkOrder 1150 ''
|
(lib.mkIf (dirHashesStr != "") (mkOrder 1150 ''
|
||||||
# Named Directory Hashes
|
# Named Directory Hashes
|
||||||
|
|
|
||||||
52
tests/modules/programs/zsh/aliases.nix
Normal file
52
tests/modules/programs/zsh/aliases.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
{ config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
shellAliases = {
|
||||||
|
test1 = "alias";
|
||||||
|
test2 = "alias2";
|
||||||
|
};
|
||||||
|
shellGlobalAliases = { global = "test"; };
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.zshrc
|
||||||
|
|
||||||
|
assertFileContent home-files/.zshrc ${
|
||||||
|
builtins.toFile "expected-.zshrc" ''
|
||||||
|
typeset -U path cdpath fpath manpath
|
||||||
|
for profile in ''${(z)NIX_PROFILES}; do
|
||||||
|
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
|
||||||
|
done
|
||||||
|
|
||||||
|
HELPDIR="@zsh@/share/zsh/$ZSH_VERSION/help"
|
||||||
|
|
||||||
|
autoload -U compinit && compinit
|
||||||
|
# History options should be set in .zshrc and after oh-my-zsh sourcing.
|
||||||
|
# See https://github.com/nix-community/home-manager/issues/177.
|
||||||
|
HISTSIZE="10000"
|
||||||
|
SAVEHIST="10000"
|
||||||
|
|
||||||
|
HISTFILE="$HOME/.zsh_history"
|
||||||
|
mkdir -p "$(dirname "$HISTFILE")"
|
||||||
|
|
||||||
|
setopt HIST_FCNTL_LOCK
|
||||||
|
unsetopt APPEND_HISTORY
|
||||||
|
setopt HIST_IGNORE_DUPS
|
||||||
|
unsetopt HIST_IGNORE_ALL_DUPS
|
||||||
|
unsetopt HIST_SAVE_NO_DUPS
|
||||||
|
unsetopt HIST_FIND_NO_DUPS
|
||||||
|
setopt HIST_IGNORE_SPACE
|
||||||
|
unsetopt HIST_EXPIRE_DUPS_FIRST
|
||||||
|
setopt SHARE_HISTORY
|
||||||
|
unsetopt EXTENDED_HISTORY
|
||||||
|
|
||||||
|
|
||||||
|
alias -- test1=alias
|
||||||
|
alias -- test2=alias2
|
||||||
|
alias -g -- global=test''
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
{
|
{
|
||||||
zsh-session-variables = ./session-variables.nix;
|
zsh-abbr = ./zsh-abbr.nix;
|
||||||
zsh-history-path-new-default = ./history-path-new-default.nix;
|
zsh-aliases = ./aliases.nix;
|
||||||
zsh-history-path-new-custom = ./history-path-new-custom.nix;
|
|
||||||
zsh-history-path-old-default = ./history-path-old-default.nix;
|
|
||||||
zsh-history-path-old-custom = ./history-path-old-custom.nix;
|
|
||||||
zsh-history-ignore-pattern = ./history-ignore-pattern.nix;
|
zsh-history-ignore-pattern = ./history-ignore-pattern.nix;
|
||||||
|
zsh-history-path-new-custom = ./history-path-new-custom.nix;
|
||||||
|
zsh-history-path-new-default = ./history-path-new-default.nix;
|
||||||
|
zsh-history-path-old-custom = ./history-path-old-custom.nix;
|
||||||
|
zsh-history-path-old-default = ./history-path-old-default.nix;
|
||||||
zsh-history-substring-search = ./history-substring-search.nix;
|
zsh-history-substring-search = ./history-substring-search.nix;
|
||||||
zsh-prezto = ./prezto.nix;
|
zsh-prezto = ./prezto.nix;
|
||||||
|
zsh-session-variables = ./session-variables.nix;
|
||||||
zsh-syntax-highlighting = ./syntax-highlighting.nix;
|
zsh-syntax-highlighting = ./syntax-highlighting.nix;
|
||||||
zsh-abbr = ./zsh-abbr.nix;
|
|
||||||
zshrc-contents-priorities = ./zshrc-content-priorities.nix;
|
zshrc-contents-priorities = ./zshrc-content-priorities.nix;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue