Created
February 22, 2012 18:29
-
-
Save baopham/1886513 to your computer and use it in GitHub Desktop.
Textmate's Python bundle modified script to run in iTerm
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
#!/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