aboutsummaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
Diffstat (limited to '.config')
-rw-r--r--.config/zsh/prompt22
1 files changed, 22 insertions, 0 deletions
diff --git a/.config/zsh/prompt b/.config/zsh/prompt
new file mode 100644
index 0000000..db66644
--- /dev/null
+++ b/.config/zsh/prompt
@@ -0,0 +1,22 @@
+#!/bin/zsh
+unset PROMPT
+setopt PROMPT_SUBST
+
+prompt_segment() {
+ content="$1"
+ [ -z "$content" ] && return
+ echo "%{\e[90m%}${content}%{\e[30m%} -> %{\e[0m%}"
+}
+
+prompt_mod_git_info() {
+ git rev-parse --is-inside-work-tree 1> /dev/null 2> /dev/null || return
+ prompt_segment "git $(git rev-parse --abbrev-ref HEAD)"
+}
+
+# only display hostname in prompt if connected over SSH
+[ -n "$SSH_CLIENT" ] && PROMPT+="$(prompt_segment '%m')"
+# working directory
+PROMPT+="$(prompt_segment '%c')"
+# git info (if in repo)
+PROMPT+="\$(prompt_mod_git_info)"
+