Last active
November 30, 2021 03:49
-
-
Save tubaterry/d09c7bbd8000750fcce4e9f943e55eca to your computer and use it in GitHub Desktop.
ZSH prompt with finger guns π π π (requires emoji support)
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
# Don't forget to set COMPLETION_WAITING_DOTS=false in your .zshrc - it doesn't always play nice with multiline prompts | |
# Troubleshooting breadcrumbs: | |
# Prompt design: http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Prompt-Expansion | |
# Zsh Line Editor (zle): http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html | |
#Broken down into its component pieces because I was tired of looking at a nearly incomprehensible string | |
FG_USER_BADGE=$'%{$fg_bold[green]%}%n@%m%{$reset_color%}' | |
FG_TIMESTAMP=$'%{$fg[blue]%}%D{[%X]}%{$reset_color%}' | |
FG_CWD_DISPLAY=$'%{$fg[white]%}[%~]%{$reset_color%}' | |
FG_SHELL_DISPLAY=$'%{$fg_bold[blue]%}%#%{$reset_color%}' | |
#We use the %G to 'glitch' zsh into forcing the string to take up 3 character widths %{string%3G%} | |
FG_GUNS_WAITING=$'%(?.%{πππ%3G%}.%{ππ π%3G%})' | |
FG_GUNS_FIRED=$'%(?.%{πππ%3G%}.%{ππ π%3G%})' | |
FG_GUNS_DISPLAY=$FG_GUNS_WAITING | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
#Setup prompt lol | |
function ββ¨οΈ () { | |
PROMPT=$''"$FG_USER_BADGE $FG_TIMESTAMP $FG_CWD_DISPLAY"' $(git_prompt_info) | |
'"$FG_GUNS_DISPLAY $FG_SHELL_DISPLAY " | |
} | |
function ππ«π₯π₯ () { | |
# Shoot them finger guns | |
FG_GUNS_DISPLAY=$FG_GUNS_FIRED | |
zle accept-line | |
ββ¨οΈ | |
# Reload em | |
zle reset-prompt | |
FG_GUNS_DISPLAY=$FG_GUNS_WAITING | |
ββ¨οΈ | |
# I've got some things in this file like a $TIMESTAMP and $SHORTRAND so i always have | |
# Easy access to make a unique filename or temp folder or whatevs. | |
if [ -f ~/.oh-my-zsh/custom/handy-vars.zsh ]; then | |
source ~/.oh-my-zsh/custom/handy-vars.zsh | |
fi | |
} | |
PROMPT="" | |
ββ¨οΈ | |
zle -N ππ«π₯π₯ | |
bindkey '^M' ππ«π₯π₯ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Today's update: 'refactor' the variable names so I don't do dingus stuff like overwriting something as heavily used as
$USER
.All the internal variables are now prefixed with
FG_
andUSER
in particular is nowFG_USER_BADGE
.Hooray for scoping.