From a7d5062653cd7dfa83aade557dd13c8e3dc83a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vitor=20Gon=C3=A7alves?= Date: Wed, 24 Jan 2024 21:04:24 -0300 Subject: [PATCH] banana zsh prompt > starship --- .config/starship.toml | 32 ++++++++++++++ .config/zsh/.zshrc | 3 +- .config/zsh/plugins/banana.zsh-theme | 63 ---------------------------- 3 files changed, 34 insertions(+), 64 deletions(-) create mode 100644 .config/starship.toml delete mode 100644 .config/zsh/plugins/banana.zsh-theme diff --git a/.config/starship.toml b/.config/starship.toml new file mode 100644 index 0000000..195b05d --- /dev/null +++ b/.config/starship.toml @@ -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 diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 4b65880..c3cc28c 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -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 diff --git a/.config/zsh/plugins/banana.zsh-theme b/.config/zsh/plugins/banana.zsh-theme deleted file mode 100644 index 2c7910b..0000000 --- a/.config/zsh/plugins/banana.zsh-theme +++ /dev/null @@ -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]%})"