Created
May 5, 2023 04:37
-
-
Save r2luna/85f12491cd4da8121fabdfb41415e8fe to your computer and use it in GitHub Desktop.
pinguim.zsh-theme
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
CURRENT_BG='NONE' | |
case ${SOLARIZED_THEME:-dark} in | |
light) CURRENT_FG='white';; | |
*) CURRENT_FG='black';; | |
esac | |
# Special Powerline characters | |
() { | |
local LC_ALL="" LC_CTYPE="en_US.UTF-8" | |
SEGMENT_SEPARATOR="" | |
} | |
# Begin a segment | |
# Takes two arguments, background and foreground. Both can be omitted, | |
# rendering default background/foreground. | |
prompt_segment() { | |
local bg fg | |
[[ -n $1 ]] && bg="%K{$1}" || bg="%k" | |
[[ -n $2 ]] && fg="%F{$2}" || fg="%f" | |
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then | |
echo -n "$SEGMENT_SEPARATOR%{$fg%} " | |
else | |
echo -n "%{$fg%}" | |
fi | |
CURRENT_BG=$1 | |
[[ -n $3 ]] && echo -n $3 | |
} | |
# End the prompt, closing any open segments | |
prompt_end() { | |
if [[ -n $CURRENT_BG ]]; then | |
echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" | |
else | |
echo -n "%{%k%}" | |
fi | |
echo -n "%{%f%}" | |
CURRENT_BG='' | |
if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then | |
echo "\n🐧 " | |
fi | |
} | |
### Prompt components | |
# Each component will draw itself, and hide itself if no information needs to be shown | |
# Git: branch/detached head, dirty status | |
prompt_git() { | |
(( $+commands[git] )) || return | |
if [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then | |
return | |
fi | |
local PL_BRANCH_CHAR | |
() { | |
local LC_ALL="" LC_CTYPE="en_US.UTF-8" | |
PL_BRANCH_CHAR=$'\ue0a0' # | |
} | |
local ref dirty mode repo_path | |
if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then | |
repo_path=$(git rev-parse --git-dir 2>/dev/null) | |
dirty=$(parse_git_dirty) | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)" | |
if [[ -n $dirty ]]; then | |
prompt_segment yellow 3 | |
else | |
prompt_segment green 8 | |
fi | |
local ahead behind | |
ahead=$(git log --oneline @{upstream}.. 2>/dev/null) | |
behind=$(git log --oneline ..@{upstream} 2>/dev/null) | |
if [[ -n "$ahead" ]] && [[ -n "$behind" ]]; then | |
PL_BRANCH_CHAR=$'\u21c5' | |
elif [[ -n "$ahead" ]]; then | |
PL_BRANCH_CHAR=$'\u2191' | |
elif [[ -n "$behind" ]]; then | |
PL_BRANCH_CHAR=$'\u2193' | |
fi | |
if [[ -e "${repo_path}/BISECT_LOG" ]]; then | |
mode=" <B>" | |
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then | |
mode=" >M<" | |
elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then | |
mode=" >R>" | |
fi | |
setopt promptsubst | |
autoload -Uz vcs_info | |
zstyle ':vcs_info:*' enable git | |
zstyle ':vcs_info:*' get-revision true | |
zstyle ':vcs_info:*' check-for-changes true | |
zstyle ':vcs_info:*' stagedstr '✚' | |
zstyle ':vcs_info:*' unstagedstr '±' | |
zstyle ':vcs_info:*' formats ' %u%c' | |
zstyle ':vcs_info:*' actionformats ' %u%c' | |
vcs_info | |
echo -n "${${ref:gs/%/%%}/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}" | |
fi | |
} | |
# Dir: current working directory | |
prompt_dir() { | |
prompt_segment black 8 '%1~' | |
} | |
## Main prompt | |
build_prompt() { | |
prompt_dir | |
prompt_git | |
prompt_end | |
} | |
PROMPT='%{%f%b%k%}$(build_prompt)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Salve, tio @r2luna! No Linux, por algum motivo o Warp não estava com quebra de linha que nem aparece nos seus vídeos. Tendo isso em vista, fiz uma pequena alteração que fez isso funcionar. Espero que não se importe com o código que deixarei abaixo que ajuda quem está enfrentando esse problema no Linux, assim como eu estava ^-^