Created
August 22, 2013 22:00
-
-
Save tzarskyz/6313356 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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