Skip to content

Instantly share code, notes, and snippets.

@devTechi
Last active October 3, 2020 17:18
Show Gist options
  • Save devTechi/5caba4003f97185a79ff36d22779c787 to your computer and use it in GitHub Desktop.
Save devTechi/5caba4003f97185a79ff36d22779c787 to your computer and use it in GitHub Desktop.
# problem: when presenting, I want to obscure
# my prompt to act like it's at root of file system
# and be very basic with no git info, etc.
# solution: this theme lets you set a ENV to the path
# of your presentation, which will help remove unneeded prompt
# features while in that path
# oh-my-zsh theme for presenting demos
# based off the default rubbyrussell theme
# save this in .oh-my-zsh/custom/themes/present.zsh-theme
# then make this your default theme in .zshrc and it will
# act normal until you set the ENV VAR 'PRESENT' to a full path
# to the folder you want to present from. This will then hide
# the current working dir name in your prompt while in that dir only
# and hide the git_prompt for it and all subdirs
# mine has a whale emote for all things docker
# simply unset the PRESENT to clear config
# example:
# cd path/to/my/code/repo/for/presentation
# export PRESENT=$(PWD)
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
function printSeparatorLine() {
# print separator and reset color
echo -n "%{$fg_bold[yellow]%}${(r:$COLUMNS::_:)}%{$reset_color%}"
}
# Print working directory in front of everything
## ${PWD/#$HOME/~} ## taken from: http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
function printPWDorNot() {
if [[ -z $PRESENT ]]; then # -z -> if String is empty
echo -n "${PWD/#$HOME/~} "
fi
}
function isPresentMode() {
if [[ ! -z $PRESENT && $PWD == $PRESENT ]]; then
echo -n "%{$reset_color%} "
elif [[ ! -z $PRESENT && $PWD == "$PRESENT"* ]]; then
echo -n "%c%{$reset_color%} "
else
#echo -n "%c%{$reset_color%} $(git_prompt_info)"
echo -n "$(printPWDorNot)%{$reset_color%} $(git_prompt_info)"
fi
}
PROMPT='$(printSeparatorLine)%{${ret_status}%} 🐳 %{$fg[cyan]%}$(isPresentMode)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
# BONUS: let this theme set this alias, then whenever you need to present,
# just cd to the path you're presenting from and type `present` 💥
alias present='export PRESENT=$(pwd)'
@Monil1601
Copy link

I'm unable to view any of my applications under the Applications directory

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