Last active
October 19, 2024 02:08
-
-
Save incompletude/99537da36c58d2b4f282856af98cb208 to your computer and use it in GitHub Desktop.
Fish Shell Title: display full path until a git root, then path relative to git root
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fish_title | |
set git_root (command git rev-parse --show-toplevel 2>/dev/null) | |
if test -n "$git_root" | |
set relative_path (string replace -- "$git_root" "" (pwd)) | |
echo (basename $git_root)$relative_path | |
else | |
echo (pwd) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment