Skip to content

Instantly share code, notes, and snippets.

@pat
Forked from jnunemaker/instructions.txt
Created June 5, 2009 18:40
Show Gist options
  • Save pat/124422 to your computer and use it in GitHub Desktop.
Save pat/124422 to your computer and use it in GitHub Desktop.
1) Add the function below into your .bash_profile, .bash_login, or other shell profile file.
2) Then you can hit nt (for new tab) anywhere
and a new tab will open up in same directory.
All credit for the idea and applescript goes to @jnunemaker - I just tidied it up.
If you can improve it further, let him know -- nunemaker@gmail.com.
function nt {
terminal_clone_command="
tell application \"Terminal\"
tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down
do script with command \"cd `pwd`; clear\" in selected tab of the front window
end tell
"
echo "$terminal_clone_command" | osascript &>/dev/null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment