FR: Dynamic multiline based on presence of git repo
Hello, this is an amazing master class in what can be done in fish shell with very little code!
I have a git environment where the repo and branch names are quite long. It would be wonderful if the script could detect that there was a git repo, and if so, switch to multiline mode.
Then for normal use (no git) the prompt and path would be on the same line, and when part of a git repo, the prompt would be on a second line to allow for the git repo/branch display.
I realize given the async nature of the git updates that it may not be possible, but I thought I would ask.
Thanks!
Actually I found this was easier than I thought! In my copy of function _hydro_pwd I added this:
if set --query hydro_git_multiline
# Use multiline only for git paths
if test -n $git_base
set --global hydro_multiline true
else
set --erase hydro_multiline
end
end
Or if you want things more compact:
if set --query hydro_git_multiline
# Use multiline only for git paths
test -n $git_base; and set --global hydro_multiline true; or set --erase hydro_multiline
end
Set hydro_git_multiline and you're all set.