Created
January 24, 2012 20:07
-
-
Save nickcharlton/1672256 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
# accept arguments | |
on open these_items | |
# loop through them | |
repeat with i from 1 to the count of these_items | |
set this_item to (item i of these_items) | |
# parse the input, to ensure it'll open okay in the terminal | |
set posix_path to POSIX path of this_item | |
set safe_path to quoted form of posix_path | |
# open up iTerm | |
tell application "iTerm.app" | |
# create a new window | |
tell (make new «class Ptrm») | |
# using the default session | |
set term to («event ITRMLNCH» given «class Pssn»:"Default Session") | |
# but, make it a little bigger | |
set «class Cols» to 99 | |
set «class Rows» to 32 | |
# then tell the session to open vim with the passed in path | |
tell term | |
«event ITRMWrte» given «class iTxt»:"vim " & safe_path | |
end tell | |
end tell | |
# then bring it to the front | |
activate | |
end tell | |
end repeat | |
end open |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment