Skip to content

Instantly share code, notes, and snippets.

@tuzz
Created September 2, 2012 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuzz/3603259 to your computer and use it in GitHub Desktop.
Save tuzz/3603259 to your computer and use it in GitHub Desktop.
An application script that opens files in iTerm's vim
on run {input, parameters}
if (count of input) > 0 then
tell application "System Events"
set runs to false
try
set p to application process "iTerm"
set runs to true
end try
end tell
tell application "iTerm"
activate
if (count of terminals) = 0 then
set t to (make new terminal)
else
set t to current terminal
end if
tell t
tell (make new session at the end of sessions)
exec command ("vim \"" & POSIX path of first item of input as text) & "\""
end tell
if not runs then
terminate first session
end if
end tell
end tell
end if
end run
@tuzz
Copy link
Author

tuzz commented Sep 2, 2012

Create an application through AppleScript Editor, then set 'Open with' for all extensions to use your application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment