Have you ever done this?
git status
on a Mercurial repo and stared at the error message for a couple of seconds?
I had seen some PS1 with repo information and I thought its time for adding that to my Bash loadable Vim-like PS1.
I found a great project called vcprompt, which supports Git, Mercurial, Subversion, CVS, and Fossil. I only need the first two actually. It is fast and that is the point of why I chose to use this.
If your PS1 is Bash script based (I probably am the only one whose PS1 is written in C code on Earth), then you can use:
__git_ps1 hg branch
to get the current branch name. The first one (a Bash function) comes with Bash completion and it runs in reasonably fast speed, but Mercurial command isnt that fast. I was giving up when I realized it would take almost one second for first run on a directory, then I saw vcprompt.
Not only it is fast but also I can have multiple VCS support at the same time with customizable output format, it is awesome. The only issue is I needed to re-code my PS1 C code because the position of the output of vcprompt.
However, it could be an advantage if I include vcprompts code in my C code. I made these changes and this is what my PS1 looks now:
0 comments:
Post a Comment