Last active
January 6, 2023 16:19
-
-
Save IDK9911/ec425bd83d3d2839c9884650a0dd1e8b to your computer and use it in GitHub Desktop.
How to setup a terminal that has a RPROMPT that informs about (git branch) we are.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eval "$(/opt/homebrew/bin/brew shellenv)" | |
#MINE | |
autoload -U colors && colors | |
RPROMPT="%{$fg[cyan]%} %c %w%{$reset_color%}" | |
#PROMPT is at zlogin | |
precmd(){ | |
#Mine | |
check=$(/Users/kazimsyed/Desktop/Sharing_stuff/funcs/kaz.sh `pwd`) | |
if [[ $check != "128" ]] | |
then | |
RPROMPT="%{$fg[yellow]%} $check %{$fg[white]%} %c %w%{$reset_color%}" | |
else | |
RPROMPT="%{$fg[cyan]%} %c %w%{$reset_color%}" | |
fi | |
} | |
#Here the precmd runs the code whenever you run the command in the shell. | |
#This will run the script /path/to/script.sh every time you enter a command in the shell. | |
#Also u can put this command either in ur ~/.zlogin or ~/.zprofile in ur zsh shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kazimsyed@kazims-MacBook-Air ~/Desktop/Sharing_stuff/funcs | |
% cat kaz.sh main funcs Fri 6 | |
x=$1 | |
y=$(dirname $x) | |
z=$(dirname $y) | |
if [[ -d $x/.git ]] || [[ -d $y/.git ]] || [[ -d $z/.git ]] | |
then | |
git branch | gawk '/*/{print $2}'; | |
fi | |
exit "128"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: to refresh ur zsh shell use the zsh-l command on the terminal that way you won't have to close the terminal again and again.