1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

zsh: optimize setOptions with array-based loops

Replace individual setopt statements with array-based loops for cfg.setOptions.
Use lib.hm.zsh.define for consistent array formatting and add unset statements
to clean up temporary variables, improving consistency with other zsh optimizations.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2025-09-26 16:48:12 -05:00
parent 04f672b5db
commit 3aaf340173
2 changed files with 7 additions and 2 deletions

View file

@ -17,7 +17,6 @@ let
;
cfg = config.programs.zsh;
bindkeyCommands = {
emacs = "bindkey -e";
viins = "bindkey -v";
@ -501,7 +500,12 @@ in
(lib.mkIf (cfg.setOptions != [ ]) (
mkOrder 950 ''
${concatStringsSep "\n" (map (option: "setopt ${option}") cfg.setOptions)}
# Set shell options
${lib.hm.zsh.define "set_opts" cfg.setOptions}
for opt in "''${set_opts[@]}"; do
setopt "$opt"
done
unset opt set_opts
''
))

View file

@ -16,6 +16,7 @@
zsh-plugins = ./plugins.nix;
zsh-prezto = ./prezto.nix;
zsh-session-variables = ./session-variables.nix;
zsh-smart-formatting = ./smart-formatting.nix;
zsh-syntax-highlighting = ./syntax-highlighting.nix;
zsh-zprof = ./zprof.nix;
zshrc-contents-priorities = ./zshrc-content-priorities.nix;