From b7518872fff6809163fe269e3a5987407bb5a60c Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 23 May 2022 12:26:36 +0100 Subject: [PATCH] chore(zsh): remove starship prompt --- roles/zsh/files/.zsh/configs/plugins.zsh | 2 -- roles/zsh/files/.zsh/configs/prompt.zsh | 14 ++++++++++++++ roles/zsh/files/.zshrc | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 roles/zsh/files/.zsh/configs/prompt.zsh diff --git a/roles/zsh/files/.zsh/configs/plugins.zsh b/roles/zsh/files/.zsh/configs/plugins.zsh index 3c7bf5e3..6a1243e0 100644 --- a/roles/zsh/files/.zsh/configs/plugins.zsh +++ b/roles/zsh/files/.zsh/configs/plugins.zsh @@ -8,5 +8,3 @@ antigen bundle zsh-users/zsh-completions antigen bundle zsh-users/zsh-syntax-highlighting antigen apply - -eval "$(starship init zsh)" diff --git a/roles/zsh/files/.zsh/configs/prompt.zsh b/roles/zsh/files/.zsh/configs/prompt.zsh new file mode 100644 index 00000000..ece80231 --- /dev/null +++ b/roles/zsh/files/.zsh/configs/prompt.zsh @@ -0,0 +1,14 @@ +source /usr/lib/git-core/git-sh-prompt + +setopt promptsubst + +git_prompt() { + local branch="$(git symbolic-ref HEAD 2> /dev/null | cut -d'/' -f3)" + local branch_truncated="${branch:0:30}" + if (( ${#branch} > ${#branch_truncated} )); then + branch="${branch_truncated}..." + fi + + [ -n "${branch}" ] && echo " (${branch})" +} +export PS1="in %{$fg[blue]%}%~%{$fg[yellow]%}$(git_prompt)%{$reset_color%} %(?.$.%{$fg[red]%}$)%b " diff --git a/roles/zsh/files/.zshrc b/roles/zsh/files/.zshrc index 5dd3d7b6..f26e05f8 100644 --- a/roles/zsh/files/.zshrc +++ b/roles/zsh/files/.zshrc @@ -12,6 +12,7 @@ sources=( 'path' 'platformsh' 'plugins' + 'prompt' 'post/completion' )