Skip to content

Instantly share code, notes, and snippets.

@csrutil
Created August 9, 2022 09:23
Show Gist options
  • Select an option

  • Save csrutil/beedcd1793cebfe73082397a79cb34df to your computer and use it in GitHub Desktop.

Select an option

Save csrutil/beedcd1793cebfe73082397a79cb34df to your computer and use it in GitHub Desktop.
display_current_dir() {
if [ -d .git ]; then
tip=$(git rev-parse --abbrev-ref HEAD)
else
tip=$(pwd)
fi
printf "\e]1337;SetBadgeFormat=%s\a" $(echo -ne "${tip##*/}\007" | base64)
}
precmd() {display_current_dir}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment