Adaptative Git Path
ebiscaia opened this issue · comments
Code of Conduct
- I agree to follow this project's Code of Conduct
What would you like to see added?
Hi guys,
I would like to when I am inside a git folder, the path to be started from the git root.
So I would have three conditions:
If I am inside a system folder, the path would look like:
/this/is/a/folder
If inside home:
~/this/is/a/folder
If inside a git folder:
<git_folder>/this/is/a/folder
I would prefer also that to be compatible/implemented with Agnoster short, so that long paths would show only the root/home/<git_folder> and the final folder. The idea is to mimic this behaviour (See 'Adaptive (git and home) (TYPEWRITTEN_RELATIVE_PATH="adaptive")' section).
Thanks,
Do you mean this? #5186
@vagabondHustler exactly what I was about to reply!
@holopin-bot @vagabondHustler helping
Congratulations @vagabondHustler, the maintainer of this repository has issued you a badge! Here it is: https://holopin.io/claim/clz1l9o1h50660cjs2z4f11e0
This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!
Thanks everyone for the help. The version in the other post led me to what I wanted. Here is my version:
- type: rprompt
segments:
- type: path
style: plain
foreground: magenta
template: "{{ if .Segments.Git.Dir }}<i>{{ .Segments.Git.RepoName }}</i>{{ if eq .Path .Segments.Git.Dir }}{{ else if eq (trimSuffix \"/\" .Parent) .Segments.Git.Dir }}/{{.Folder}}{{else}}/../{{.Folder}}{{end}}{{ else }}{{ .Path }}{{ end }}"
properties:
style: agnoster_short
This solution does not completely work because with agnoster_short a .Path is rendered
~/../folder
whereas .Segments.Git.Dir renders
~/this/is/a/folder
which are then considered different folders.
Some possible solutions:
- .Segments.Git.Dir to follow the path style.
- have a .Segment.Git.Location which would show the raw path so then it is possible to compare to .Location
for now I changed from agnoster_short to full as at least the git repos will show me the path in relation to the git root.
Cheers