Skip to content

Instantly share code, notes, and snippets.

@eddieh
Last active December 11, 2019 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddieh/8aeecf8b6bca477502a16d9ab5f6b031 to your computer and use it in GitHub Desktop.
Save eddieh/8aeecf8b6bca477502a16d9ab5f6b031 to your computer and use it in GitHub Desktop.
Name tabs based on the current directory in Terminal.app
# set the current tab's name
function tab_name {
printf "\e]1;$1\a"
}
# set the tab's name to the current working directory name
function update_tab_name {
tab_name "$(basename $PWD)"
}
# do this before printing a prompt
export PROMPT_COMMAND="update_terminal_cwd; update_tab_name;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment