From 0c5a757de41de6fbafba3246e97d0375b8426e9b Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Mon, 22 Feb 2016 17:25:28 +0100 Subject: zsh: slightly improve the prompt --- .zsh/prompt | 14 ++++++++++++++ .zshrc | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .zsh/prompt diff --git a/.zsh/prompt b/.zsh/prompt new file mode 100644 index 0000000..17e578d --- /dev/null +++ b/.zsh/prompt @@ -0,0 +1,14 @@ +# functions +function git_prompt_info { + git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' +} + +# Load colors +autoload -U colors && colors + +setopt promptsubst +local CUR_BRANCH='$(git_prompt_info)' + +PROMPT="%{$fg[blue]%}[%{$fg[yellow]%}%n%{$fg[blue]%}@%{$fg[green]%}%m%{$fg[yellow]%}:%~%{$fg[blue]%}]%{$fg[red]%}${CUR_BRANCH}%{$fg[green]%}%# %{$reset_color%}" + +RPROMPT='[%?]' diff --git a/.zshrc b/.zshrc index b516b3b..675aabd 100644 --- a/.zshrc +++ b/.zshrc @@ -6,9 +6,13 @@ SAVEHIST=1000 # The following lines were added by compinstall zstyle :compinstall filename '/home/oliver/.zshrc' -autoload -Uz compinit +autoload -Uz compinit promptinit compinit +promptinit # End of lines added by compinstall # Alias definitions. [[ -f ~/.zsh/aliases ]] && source ~/.zsh/aliases + +# Prompt definitions. +[[ -f ~/.zsh/prompt ]] && source ~/.zsh/prompt -- cgit v0.12