summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlliver Schinagl <oliver@schinagl.nl>2016-02-22 16:25:28 (GMT)
committerOlliver Schinagl <oliver@schinagl.nl>2017-04-18 08:04:55 (GMT)
commit0c5a757de41de6fbafba3246e97d0375b8426e9b (patch)
treee8b7a21fa3bb11a8e79169ef548eb5616eda8435
parent3fa6586955df7921697a8c6cbba5313068f479d3 (diff)
downloaddotfiles-0c5a757de41de6fbafba3246e97d0375b8426e9b.zip
dotfiles-0c5a757de41de6fbafba3246e97d0375b8426e9b.tar.gz
dotfiles-0c5a757de41de6fbafba3246e97d0375b8426e9b.tar.bz2
zsh: slightly improve the prompt
-rw-r--r--.zsh/prompt14
-rw-r--r--.zshrc6
2 files changed, 19 insertions, 1 deletions
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