summaryrefslogtreecommitdiff
path: root/config/essentials
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-15 15:26:23 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-08-15 15:33:15 +0200
commit63c16da0da3e9b0cdc3fb6f9cd3031dc2297a09c (patch)
tree3a12846837cd13d6440de307de47669c9f06b895 /config/essentials
parent0ea5e7a97b7ccba919d5c495e3e328b30cec9e03 (diff)
[.zshrc] refactored git_parse_remote
use cut instead of sed to get the state of the remote, now you could use this command: git branch -v 2> /dev/null | sed '/^*/!d;s/^[^[]*\[\([^ ]*\).*$/\1/' but at this point, it feels more like intellectual masturbation.
Diffstat (limited to 'config/essentials')
-rw-r--r--config/essentials/zsh/.zshrc6
1 files changed, 3 insertions, 3 deletions
diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc
index 0665533..769c805 100644
--- a/config/essentials/zsh/.zshrc
+++ b/config/essentials/zsh/.zshrc
@@ -121,13 +121,13 @@ RPROMPT='%F{blue}$(parse_git_remote)%f%F{red}$(parse_git_status)%f%F{green}$(par
setopt prompt_subst
parse_git_remote() {
- b="$(git branch -v 2> /dev/null | grep "^*" | sed 's/.\+\[\([^ ]\+\).*$/\1/')"
+ b="$(git branch -v 2>/dev/null | grep "^*" | cut -f2 -d'[' | cut -f1 -d' ')"
if [ "$b" = "behind" ]
then
- echo -n "↓ "
+ printf "↓ "
elif [ "$b" = "ahead" ]
then
- echo -n "↑ "
+ printf "↑ "
fi
}
parse_git_branch() {