From d4f2ccac2392d871078ca5a9a1063223d421dea9 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Sun, 8 May 2022 11:39:14 +0200 Subject: [PATCH] Much more clean and performance-wise array declaration respecting the POSIX syntax in zsh's `powermeli` theme --- zsh/.config/zsh/plugins/powermeli.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zsh/.config/zsh/plugins/powermeli.zsh-theme b/zsh/.config/zsh/plugins/powermeli.zsh-theme index 26efe4b..6ee2777 100755 --- a/zsh/.config/zsh/plugins/powermeli.zsh-theme +++ b/zsh/.config/zsh/plugins/powermeli.zsh-theme @@ -53,9 +53,9 @@ prompt_git() { git_str="" if [ -n "$git_status" ]; then prompt_segment "$SEGMENT_SEPARATOR" yellow black - # Using `emulate` here is ugly as hell, but necessary to not get syntax - # error from `sh/dash`. Hope it doesn't costs too much in performances. - [ -z ${ZSH_VERSION+x} ] && emulate zsh -c 'git_status=( ${(f)"${git_Status}"} )' + # If sourced or executed by zsh overwrite with an associative array + # https://zsh.sourceforge.io/Doc/Release/Parameters.html#Array-Parameters + [ -z ${ZSH_VERSION+x} ] && set -A git_status ${(f)"${git_status}"} OLDIFS="$IFS" IFS=" "