Skip to content

Instantly share code, notes, and snippets.

@tzarskyz
Created August 22, 2013 22:00
Show Gist options
  • Save tzarskyz/6313356 to your computer and use it in GitHub Desktop.
Save tzarskyz/6313356 to your computer and use it in GitHub Desktop.
function tabname {
# Will use current dir name if called without arg.
printf "\e]1;${1-$(basename `pwd`)}\a"
}
function winname {
# Will use current dir name if called without arg.
printf "\e]2;${1-$(basename `pwd`)}\a"
}
function tab {
# Will cd into current dir if called without arg.
osascript -e 'tell application "Terminal"' \
-e 'tell application "System Events" to keystroke "t" using {command down}' \
-e "do script \"cd `pwd` && cd ${1-.} && tabname && clear\" in front window" \
-e 'end tell' > /dev/null
}
alias t='tab'
alias tn='tabname'
alias wn='winname'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment