| @@ -51,7 +51,7 @@ precmd.is_git_repo() { | ||||
| 		if [[ -r "$_pwd/.git/HEAD" ]]; then | ||||
| 			return 0 | ||||
| 		else | ||||
| 			_pwd=${pwd%/*} | ||||
| 			_pwd=${_pwd%/*} | ||||
| 		fi | ||||
| 	done | ||||
|  | ||||
| @@ -72,6 +72,14 @@ precmd.git() { | ||||
| 	done < <(git status --porcelain -bu 2>/dev/null) | ||||
|  | ||||
| 	git_branch_name=${git_branch_info%%...*} | ||||
| 	[[ $git_branch_info =~ ahead\ ([0-9]+) ]] && git_ahead=$match[1] | ||||
|  | ||||
| 	git_status_colour='green' | ||||
|  | ||||
| 	(( git_ahead )) && { | ||||
| 		git_status_short+='a' | ||||
| 		git_status_colour='yellow' | ||||
| 	} | ||||
|  | ||||
| 	(( git_unstaged )) && { | ||||
| 		git_status_short+='c' | ||||
| @@ -84,8 +92,6 @@ precmd.git() { | ||||
| 	} | ||||
|  | ||||
| 	git_status_short=${git_status_short:-"ok"} | ||||
| 	git_status_colour=${git_status_colour:-"green"} | ||||
|  | ||||
| 	git_prompt_msg="(%F{cyan}$git_branch_name%f[%F{$git_status_colour}${git_status_short}%f]) " | ||||
|  | ||||
| 	printf '%s' $git_prompt_msg | ||||
|   | ||||
		Reference in New Issue
	
	Block a user