-
Notifications
You must be signed in to change notification settings - Fork 53
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
Multiline prompt #25
Multiline prompt #25
Conversation
Thank you, @mattmc3! Can you upload a screenshot, video, or GIF to demonstrate this new functionality? |
@jorgebucaran - Is this the kind of thing you were looking for? |
Any word on if this is able to merge or if there's anything more I need to do? |
Thank you, @mattmc3. I think this is probably fine. Do you have any info on how this might affect performance? |
set --query fish_prompt_pwd_dir_length || set --local fish_prompt_pwd_dir_length 1 | ||
if test "$fish_prompt_pwd_dir_length" -le 0 || test "$hydro_multiline" = true | ||
set --global _hydro_pwd ( | ||
string replace --ignore-case -- ~ \~ $PWD | | ||
string replace --regex -- '([^/]+)$' "\x1b[1m\$1\x1b[22m" | | ||
string replace --regex --all -- '(?!^/$)/' "\x1b[2m/\x1b[22m" | ||
) | ||
else | ||
set --local root (command git rev-parse --show-toplevel 2>/dev/null | | ||
string replace --all --regex -- "^.*/" "") | ||
set --global _hydro_pwd ( | ||
string replace --ignore-case -- ~ \~ $PWD | | ||
string replace -- "/$root/" /:/ | | ||
string replace --regex --all -- "(\.?[^/]{"$fish_prompt_pwd_dir_length"})[^/]*/" \$1/ | | ||
string replace -- : "$root" | | ||
string replace --regex -- '([^/]+)$' "\x1b[1m\$1\x1b[22m" | | ||
string replace --regex --all -- '(?!^/$)/' "\x1b[2m/\x1b[22m" | ||
) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only place that maybe feels a little kludgy and duplicative to me, but I don't think it will have any impact on performance or usability.
I don't have any reason to think that these changes would impact performance in any meaningful way, and have used this fork as my daily driver prompt for a couple months now. There's effectively one more |
else | ||
set --global _hydro_newline "" | ||
end | ||
end && hydro_multiline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mischievous, but I'll allow it, lol. 👍
I've been using the multiline prompt and would prefer if it truncated the prompt, instead of displaying the full path. If we want to display the full path instead, here's a way: set fish_prompt_pwd_dir_length -1 Hopefully, we can agree that this isn't so bad? 🙏 cc @mattmc3 |
That works! As long as there's a way to show the full path, the default value of |
This is an alternative implementation of #21 that builds on the idea with a couple extras:
fish_prompt_pwd_dir_length
variable (similar to the prompt_pwd implementation)