-
-
Save spoike/25fb4fff63305f5dc6eef55ac56cd3a1 to your computer and use it in GitHub Desktop.
Random emoji theme for zpresto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# A minimal emoji theme. | |
# | |
# Authors: | |
# Mikael Brassman | |
# | |
# Features: | |
# - Displays a random emoji as prompt | |
# | |
# Usage: | |
# prompt emoji | |
# | |
# In ~/.zpreztorc: | |
# zstyle ':prezto:module:prompt' theme 'emoji' | |
# | |
# Load dependencies. | |
pmodload 'helper' | |
function prompt_emoji_precmd { | |
setopt LOCAL_OPTIONS | |
unsetopt XTRACE KSH_ARRAYS | |
# Get Git repository information. | |
if (( $+functions[git-info] )); then | |
git-info | |
fi | |
} | |
function prompt_emoji_help { | |
cat <<EOT | |
This prompt's prefix symbol and colors are customizable: | |
prompt emoji | |
In ~/.zpreztorc: | |
zstyle ':prezto:module:prompt' theme 'emoji' | |
EOT | |
} | |
function prompt_emoji_preview { | |
if (( $# > 0 )); then | |
prompt_preview_theme 'emoji' "$@" | |
else | |
prompt_preview_theme 'emoji' | |
fi | |
} | |
function prompt_emoji_setup { | |
setopt LOCAL_OPTIONS | |
unsetopt XTRACE KSH_ARRAYS | |
prompt_opts=(cr percent subst) | |
EMOJI=(๐ฉ ๐ฆ ๐ ๐ ๐จ ๐ ๐ญ ๐ฝ โ๏ธ ๐ฌ ๐ ๐ท ๐ผ ๐ถ ๐ธ ๐ง ๐ณ ๐ ๐ฃ ๐ป ๐ฎ ๐ฐ ๐ ๐พ ๐ ๐ช ๐ ๐ ๐ ๐ ๐ ) | |
prefix="$EMOJI[$RANDOM%$#EMOJI+1]" | |
primary_color="gray" | |
secondary_color="blue" | |
# Load required functions. | |
autoload -Uz add-zsh-hook | |
# Add hook for calling git-info before each command. | |
add-zsh-hook precmd prompt_emoji_precmd | |
# Set git-info parameters. | |
zstyle ':prezto:module:git:info' verbose 'yes' | |
zstyle ':prezto:module:git:info:dirty' format "%%B%F{$secondary_color}]%f%%b %F{yellow}โก%f " | |
zstyle ':prezto:module:git:info:clean' format "%B%F{$secondary_color}]%f%b" | |
zstyle ':prezto:module:git:info:branch' format "%%B%F{$secondary_color}[%f%%b%%B%F{$primary_color}%b%f%%b" | |
zstyle ':prezto:module:git:info:keys' format \ | |
'prompt' '%b%C%D' \ | |
'rprompt' '' | |
# Define prompts. | |
PROMPT='%B%F{$primary_color}${prefix}%f%b %B%F{$secondary_color}%c%f%b ${git_info:+${(e)git_info[prompt]}} ' | |
RPROMPT='' | |
} | |
prompt_emoji_setup "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Random Emoji Theme for Prezto
Simple theme that displays a random emoji as a prefix.
Installation
Download the raw file to
.zprezto/modules/prompt/functions
.Usage
In ~/.zpreztorc:
Colophon
Based on the script over https://gist.github.com/oshybystyi/2c30543cd48b2c9ecab0 and the Prezto's own
cloud
theme.