Skip to content

Instantly share code, notes, and snippets.

@incompletude
Last active October 19, 2024 02:08
Show Gist options
  • Save incompletude/99537da36c58d2b4f282856af98cb208 to your computer and use it in GitHub Desktop.
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
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