-
Notifications
You must be signed in to change notification settings - Fork 85
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
Prompt format string #65
Conversation
I haven't done any documentation yet but the basic functionality is working. I've also switched the basic prompt in prompt.zsh and prompt.bash to use the new render_prompt function and a default |
Wow |
👍 It looks good @michaeldfallen ! Thanks for taking the time to address these. 💪 |
Looks great |
Thanks guys. I want to run a few performance tests to make sure the extra subshells and sed command don't slow down too much. |
This fails for me on Ubuntu:
This fixes it:
|
And when will be git-radar update with this feature? |
@BoGeM sorry, I've been away on honeymoon and my new wife wouldn't much like it if I spent the time coding. Back now and I'm going to look in to this and merge soon. Just looking in to the performance and the bug @slackorama mentioned above. |
Congrats on the marriage! Tell your wife I said thanks for git-radar. It's a huge time saver. I found another issue in this branch. If your branch has a slash in it (if you use git-flow branches are named "feature/some_cool_fix"), it will break the sed commands: This works as a fix for me:
Let me know if you want me to put together a PR or not. |
@slackorama thanks :-) and good catch. This was a major change so thanks for flushing out the bugs. I've created performance tests in master and run them on this, doesn't seem to slow down much, 10ms at most. The real slow down is |
I've added the fixes by @slackorama so I think this is good to go. |
Readme looks good enough for now -> merging |
Supeer |
Just released it on brew: https://github.com/michaeldfallen/git-radar/releases/tag/v0.4 |
In response issues #62, #57, #54, #17 (so quite a lot of people) and pull request #40, which was an attempt to address some of these points, I have added the ability to describe the shape of the prompt fully through a format string.
You export this as
GIT_RADAR_FORMAT
or set it in your.gitradarrc
file.%{remote}
- Output the remote status part%{branch}
- Output the branch name, or sha reference if detached%{local}
- Output the local commit diff%{changes}
- Output the file changesWith this you can create very flexible and unique prompt, for example:
${branch}%{local}%{changes}
=master1↑1M
[${branch}] - %{local} - %{changes}
=[master] - 1↑ - 1M
It also supports prefixes and suffixes that only output if there is something to output:
%{[prefix] :local: [suffix]}
with no local commits would produce nothingwith local commits would produce
[prefix] 1↑ [suffix]
It also supports both zsh colours and bash colour codes so you can colour the parts you add to the prompt really easily.