Skip to content

Instantly share code, notes, and snippets.

@sorah
Last active August 29, 2015 14:00
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 sorah/11167333 to your computer and use it in GitHub Desktop.
Save sorah/11167333 to your computer and use it in GitHub Desktop.
update_terminal_cwd() {
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
echo -ne "\033]2;${USER}@${HOSTNAME%%.*}: ${PWD/#$HOME/~}\007"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment