Author: Honza Pokorny <me@honza.ca>
better git prompt
fish/config.fish | 8 ++++++--
diff --git a/fish/config.fish b/fish/config.fish index 3b7c822602cda6e799391aa4b51c269adcf48c30..27ca67075bf7df071e7976ba8f13332843f2d8b4 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -136,13 +136,17 @@ end end function git_prompt - set -l branch_name (command git symbolic-ref --short HEAD ^/dev/null) + set branch_name (command git symbolic-ref --short HEAD ^/dev/null) + + if test -z "$branch_name" + set branch_name (command git show --format="%D" --no-patch ^/dev/null) + end if test -n "$branch_name" set_color normal printf ' on ' set_color magenta - printf '%s ' "$branch_name" + printf '%s' "$branch_name" set_color normal end end