Skip to content

Instantly share code, notes, and snippets.

@nickcharlton
Created January 24, 2012 20:07
Show Gist options
  • Save nickcharlton/1672256 to your computer and use it in GitHub Desktop.
Save nickcharlton/1672256 to your computer and use it in GitHub Desktop.
# 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