Skip to content

Instantly share code, notes, and snippets.

@spoike
Forked from oshybystyi/random-emoji.zsh-theme
Last active October 28, 2016 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spoike/25fb4fff63305f5dc6eef55ac56cd3a1 to your computer and use it in GitHub Desktop.
Save spoike/25fb4fff63305f5dc6eef55ac56cd3a1 to your computer and use it in GitHub Desktop.
Random emoji theme for zpresto
#
# 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 "$@"
@spoike
Copy link
Author

spoike commented Oct 28, 2016

Random Emoji Theme for Prezto

image

Simple theme that displays a random emoji as a prefix.

Installation

Download the raw file to .zprezto/modules/prompt/functions.

cd ~/.zprezto/modules/prompt/functions
curl -fLo "prompt-emoji-setup" https://gist.github.com/spoike/25fb4fff63305f5dc6eef55ac56cd3a1/raw/0cc77e586f38678152afb65796498c81a449b95e/prompt-emoji-setup

Usage

prompt emoji

In ~/.zpreztorc:

zstyle ':prezto:module:prompt' theme 'emoji'

Colophon

Based on the script over https://gist.github.com/oshybystyi/2c30543cd48b2c9ecab0 and the Prezto's own cloud theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment