agnoster / agnoster-zsh-theme

A ZSH theme designed to disclose information contextually, with a powerline aesthetic
4.02k stars 591 forks source link

My config in `~/.oh-my-zsh/themes/agnoster.zsh-theme` to random emoji. #116

Closed emunozhern closed 4 years ago

emunozhern commented 5 years ago

My config in ~/.oh-my-zsh/themes/agnoster.zsh-theme to random emoji.

prompt_context() {
  # Custom (Random emoji)
  emojis=("⚡️" "🔥" "💀" "👑" "😎" "🐸" "🐵" "🦄" "🌈" "🍻" "🚀" "💡" "🎉" "🔑" "🇹🇭" "🚦" "🌙")
  RAND_EMOJI_N=$(( $RANDOM % ${#emojis[@]} + 1))
  prompt_segment black default "${emojis[$RAND_EMOJI_N]} "
}

image

Originally posted by @biigpongsatorn in https://github.com/agnoster/agnoster-zsh-theme/issues/39#issuecomment-470603968

apjanke commented 4 years ago

You can use "local n" instead of $RAND_EMOJI_N if you want to avoid clobbering variables set by the user or other code.

apjanke commented 4 years ago

FYI, I added this to my AgnosterJ fork: https://github.com/apjanke/agnosterj-zsh-theme/commit/adb1be2a8c289317392b5dc004a0fdd527fefc16.