Displaying the current repo in your prompt
I tend to nest repos a lot in my usual workflow (The common elements are generally ~/code/ext/[repo], but with the pull_ext infrastructure I wrote, >5 levels of nesting are not uncommon).
To work around this, I wanted my prompt to hilight the root of the current repository and also tell me what type of repo it is.
vcs_info does this, but I find the configuration quite inflexible, and some of the tests are quite expensive so I decided to quickly hack something together.
I arrived at
Which recurses back from the current directory, looks for the metadata for the 4 VCS systems that I use, and exports a character for my prompt and for the colored PWD.
Then I only run this on directory changes to keep things quick (Which does mean that `git init .` won’t update the prompt until you shuffle about a bit.
The net result is this
This entry was posted in Articles
and tagged environment
. Bookmark the permalink