Created
March 27, 2018 18:30
-
-
Save mmarchini/47b9d1ab8ef430e4cdedd020f159c0dc to your computer and use it in GitHub Desktop.
My ZSH theme, inspired on lambda-gister and lambda-mod
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
#!/usr/bin/env zsh | |
local LAMBDA="%(?,%{$fg_bold[green]%}λ,%{$fg_bold[red]%}λ)" | |
function get_pwd(){ | |
git_root=$PWD | |
while [[ $git_root != / && ! -e $git_root/.git ]]; do | |
git_root=$git_root:h | |
done | |
if [[ $git_root = / ]]; then | |
unset git_root | |
prompt_short_dir=%3~ | |
else | |
parent=${git_root%\/*} | |
prompt_short_dir=${PWD#$parent/} | |
fi | |
echo $prompt_short_dir | |
} | |
function get_right_prompt() { | |
echo "[%{${fg_bold[yellow]}%}%*%{$reset_color%}]" | |
} | |
PROMPT=$'\n'$LAMBDA'\ | |
%{$fg_no_bold[magenta]%}[$(get_pwd)]\ | |
$(git_prompt_info) | |
%{$fg_bold[cyan]%}→ %{$reset_color%}' | |
RPROMPT='$(get_right_prompt)' | |
# Format for git_prompt_info() | |
DISABLE_UNTRACKED_FILES_DIRTY="true" | |
ZSH_THEME_GIT_PROMPT_PREFIX="at %{$fg[blue]%} " | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%} ✔" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%} ✔" | |
# Format for git_prompt_status() | |
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+" | |
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!" | |
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-" | |
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>" | |
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#" | |
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?" | |
# Format for git_prompt_ahead() | |
ZSH_THEME_GIT_PROMPT_AHEAD=" %{$fg_bold[white]%}^" | |
# Format for git_prompt_long_sha() and git_prompt_short_sha() | |
ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$fg_bold[white]%}[%{$fg_bold[blue]%}" | |
ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$fg_bold[white]%}]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment