-
Notifications
You must be signed in to change notification settings - Fork 424
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
Show path relative to repo #349
Comments
No and yes.
Yes it is probably possible. Is it sane to look into this when displaying the prompt? No. Too much runtime cost. That would impact 99% of liquidprompt users that use git repo without submodules. |
Or just color the part of the prompt that is relative to the base of the VCS. At one time I used some code that printed it like this: ~/projects/some-repo[master]/sub/dir. However, given the different approach of liquidprompt (only append things when needed) and features such as part shortening, this might not work. |
Sorry for the advertisement, but maybe you are interested how I do this in my prompt. I use an environment variable PROMPT_BASES to store special paths which should be reduced to a name. It should be easy to adopt this to your prompt. |
I like the idea, but it conflicts with features related to the path management (shortening, for instance). I think the idea of @paulvt feels more ergonomic: just highlight the part of the path that is under to the current repository root (the part that is shown). The prompt of @rhopfer makes me realize that we can also color the slashes. |
I'd be happy to put in the hours to support both. I know I have not properly addressed the issue of path shortening (I listed it in the TODOs of my PR), but I would assume it should simply shorten the shortened (relative to repo) path. Either way, I have been using this at work for the last week and it's been really nice to use. I made a quite asciinema demo to demonstrate it: https://asciinema.org/a/21be5t92ib26uddrs9ehuaovr. |
This was (partially) implemented as part of v2.0.0-rc.1. By default, the VCS repo root is highlighted and never shortened, no matter which path shortening method is selected (can be disabled with However, none of the current path shortening methods remove all of the path before the repo root (relative to repo root). As I mentioned in #465 (comment), I am open to a new path shortening method that shows relative to the repo root, if someone wants to make a PR on that. |
It would be nice if I could display the path in my prompt relative to the git repository I am working on. This removes all the unnecessary parts of the path and leaves me to focus on the repo itself. Is this functionality already available, and if not is it something worthwhile looking into?
Furthermore, would it be possible to know if we are inside a submodule? So we could show the housing git repo's name somewhere as well? This would be a recursive op, so the displayed level of parent repos would need to be controlled.
The text was updated successfully, but these errors were encountered: