Skip to content

Instantly share code, notes, and snippets.

@baopham
Created February 22, 2012 18:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save baopham/1886513 to your computer and use it in GitHub Desktop.
Save baopham/1886513 to your computer and use it in GitHub Desktop.
Textmate's Python bundle modified script to run in iTerm
#!/bin/bash
TPY=${TM_PYTHON:-python}
esc () {
STR="$1" ruby <<"RUBY"
str = ENV['STR']
str = str.gsub(/'/, "'\\\\''")
str = str.gsub(/[\\"]/, '\\\\\\0')
print "'#{str}'"
RUBY
}
osascript <<- APPLESCRIPT
tell application "iTerm"
activate
make new terminal
tell the first terminal
launch session "Default Session"
tell the last session
write text "python $TM_FILEPATH"
end tell
end tell
end tell
APPLESCRIPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment