Skip to content

Instantly share code, notes, and snippets.

@adamhunter
Created August 2, 2013 13:29
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 adamhunter/6139889 to your computer and use it in GitHub Desktop.
Save adamhunter/6139889 to your computer and use it in GitHub Desktop.
# Set Apple Terminal.app resume directory (OS X Lion feature)
if [[ $TERM_PROGRAM == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]] {
# function must be named chpwd so when new tab is opened it will go to the
# current working directory
function chpwd {
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
chpwd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment