diff --git a/zsh/themes/custom-groups.zsh-theme b/zsh/themes/custom-groups.zsh-theme new file mode 100644 index 0000000..5916a38 --- /dev/null +++ b/zsh/themes/custom-groups.zsh-theme @@ -0,0 +1,31 @@ +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}▴%{$fg[white]%}]%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="]%{$reset_color%} " + +function braille_prompt() { + local input="${1:-0}" # если аргумент не передан, по умолчанию 0 + local hash=$( echo "$input" | md5sum | cut -d' ' -f1) + local braille=$(echo $hash | xxd -r -p | od -An -vtu1 | \ + awk '{for(i=1;i<=NF;i++) printf "\\U%08x", 0x2800 + $i}' | xargs -0 printf "%b") + + local color='\033[1;30m' + local reset='\033[0m' + local prefix='▣─□□□─────────────────╼⢸' + local postfix='⡇╾──────────╼━━━━' + echo -e "${color}${prefix}${braille}${postfix}${reset}" +} + +vcs_status() { + git_prompt_info +} + +precmd() { + local exit_code=$? + braille_prompt "$exit_code" + if [ $exit_code -ne 0 ]; then + echo "├╼ Exit code: $exit_code" + fi +} + +PROMPT='└╼ %2~ $(vcs_status)»%b '