banana zsh prompt > starship
This commit is contained in:
parent
693c77255b
commit
a7d5062653
|
@ -0,0 +1,32 @@
|
|||
add_newline = false
|
||||
|
||||
format = "$username[@](bold green)$hostname $directory$git_branch$git_status$character"
|
||||
right_format = "$cmd_duration$time"
|
||||
|
||||
[username]
|
||||
show_always = true
|
||||
format = "[$user](bold yellow)"
|
||||
|
||||
[hostname]
|
||||
ssh_only = false
|
||||
format = "[$hostname](bold blue)"
|
||||
|
||||
[git_branch]
|
||||
format = "[$symbol$branch(:$remote_branch)]($style)"
|
||||
|
||||
[git_status]
|
||||
format = "[$all_status]($style) "
|
||||
|
||||
[character]
|
||||
success_symbol = '[➜](bold green)'
|
||||
error_symbol = '[✗](bold red)'
|
||||
|
||||
# right side
|
||||
|
||||
[cmd_duration]
|
||||
min_time = 200
|
||||
format = "took [$duration](underline bold yellow) "
|
||||
|
||||
[time]
|
||||
format = "[$time](fg:bold purple)"
|
||||
disabled = false
|
|
@ -21,7 +21,8 @@ source "$ZPLUGINS/zsh-completions/zsh-completions.plugin.zsh"
|
|||
source "$ZPLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh"
|
||||
source "$ZPLUGINS/zsh-bd/bd.zsh"
|
||||
source "$ZPLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||
source "$ZPLUGINS/banana.zsh-theme"
|
||||
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
HISTFILE="$HOME/.local/share/zsh/histfile"
|
||||
HISTSIZE=110000
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
function __git_prompt_git() {
|
||||
GIT_OPTIONAL_LOCKS=0 command git "$@"
|
||||
}
|
||||
|
||||
function parse_git_dirty() {
|
||||
local STATUS
|
||||
local -a FLAGS
|
||||
FLAGS=('--porcelain')
|
||||
if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
|
||||
if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
|
||||
FLAGS+='--untracked-files=no'
|
||||
fi
|
||||
case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
|
||||
git)
|
||||
# let git decide (this respects per-repo config in .gitmodules)
|
||||
;;
|
||||
*)
|
||||
# if unset: ignore dirty submodules
|
||||
# other values are passed to --ignore-submodules
|
||||
FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
|
||||
;;
|
||||
esac
|
||||
STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1)
|
||||
fi
|
||||
if [[ -n $STATUS ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
}
|
||||
|
||||
function git_prompt_info() {
|
||||
# If we are on a folder not tracked by git, get out.
|
||||
# Otherwise, check for hide-info at global and local repository level
|
||||
if ! __git_prompt_git rev-parse --git-dir &> /dev/null \
|
||||
|| [[ "$(__git_prompt_git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
local ref
|
||||
ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \
|
||||
|| ref=$(__git_prompt_git describe --tags --exact-match HEAD 2> /dev/null) \
|
||||
|| ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) \
|
||||
|| return 0
|
||||
|
||||
# Use global ZSH_THEME_GIT_SHOW_UPSTREAM=1 for including upstream remote info
|
||||
local upstream
|
||||
if (( ${+ZSH_THEME_GIT_SHOW_UPSTREAM} )); then
|
||||
upstream=$(__git_prompt_git rev-parse --abbrev-ref --symbolic-full-name "@{upstream}" 2>/dev/null) \
|
||||
&& upstream=" -> ${upstream}"
|
||||
fi
|
||||
|
||||
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
|
||||
}
|
||||
|
||||
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
|
||||
local host_status="$USER@${:-%m}"
|
||||
PROMPT='${ret_status}${host_status} %{$fg[cyan]%}%~%{$reset_color%} $(git_prompt_info)'
|
||||
|
||||
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]%})"
|
Loading…
Reference in New Issue