-
Notifications
You must be signed in to change notification settings - Fork 4
Expose current checked out tag #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @delthas. I agree this is a very good one to have. Looks like |
Also, there's the For example, to see this in the asciiship prompt, do the following changes (replacing @@ -34,7 +34,7 @@ fi
typeset -gA git_info
if (( ${+functions[git-info]} )); then
zstyle ':zim:git-info:branch' format '%b'
- zstyle ':zim:git-info:commit' format 'HEAD %F{green}(%c)'
+ zstyle ':zim:git-info:position' format 'HEAD %F{green}(%p)'
zstyle ':zim:git-info:action' format ' %F{yellow}(${(U):-%s})'
zstyle ':zim:git-info:stashed' format '\\\$'
zstyle ':zim:git-info:unindexed' format '!'
@@ -43,7 +43,7 @@ if (( ${+functions[git-info]} )); then
zstyle ':zim:git-info:behind' format '<'
zstyle ':zim:git-info:keys' format \
'status' '%S%I%i%A%B' \
- 'prompt' ' on %%B%F{magenta}%b%c%s${(e)git_info[status]:+" %F{red}[${(e)git_info[status]}]"}%f%%b'
+ 'prompt' ' on %%B%F{magenta}%b%p%s${(e)git_info[status]:+" %F{red}[${(e)git_info[status]}]"}%f%%b'
add-zsh-hook precmd git-info
fi Example:
EDIT: Normally you'd want to fallback to showing the current commit short hash in case no tag was found, using @@ -34,7 +34,7 @@ fi
typeset -gA git_info
if (( ${+functions[git-info]} )); then
zstyle ':zim:git-info:branch' format '%b'
+ zstyle ':zim:git-info:position' format 'HEAD %F{green}(%p)'
zstyle ':zim:git-info:commit' format 'HEAD %F{green}(%c)'
zstyle ':zim:git-info:action' format ' %F{yellow}(${(U):-%s})'
zstyle ':zim:git-info:stashed' format '\\\$'
zstyle ':zim:git-info:unindexed' format '!'
@@ -43,7 +43,7 @@ if (( ${+functions[git-info]} )); then
zstyle ':zim:git-info:behind' format '<'
zstyle ':zim:git-info:keys' format \
'status' '%S%I%i%A%B' \
- 'prompt' ' on %%B%F{magenta}%b%c%s${(e)git_info[status]:+" %F{red}[${(e)git_info[status]}]"}%f%%b'
+ 'prompt' ' on %%B%F{magenta}%b$(coalesce %p %c)%s${(e)git_info[status]:+" %F{red}[${(e)git_info[status]}]"}%f%%b'
add-zsh-hook precmd git-info
fi |
Is your feature request related to a problem? Please describe.
I often check out different tags in my projects to deploy them with different versions for testing. When I have a tag checked out, I'd really like to see the tag name in my prompt instead of a commit hash (that I never remember).
Describe the solution you'd like
I'd like git-info to expose the tag name of the current checked out tag (if a tag is checked out, so when in checked out HEAD state, but specifically when HEAD is pointing to a tag).
Describe alternatives you've considered
I suppose I could somehow do that manually by adding some script in my prompt to call git and check every time whether I have a tag checked out and append that to my prompt, but it's hacky and I think it could be useful to have that in git-info for other users.
Additional context
No response
The text was updated successfully, but these errors were encountered: