Skip to content

Instantly share code, notes, and snippets.

@drscream
Created July 6, 2014 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save drscream/0d2b7030b51ad6640798 to your computer and use it in GitHub Desktop.
Save drscream/0d2b7030b51ad6640798 to your computer and use it in GitHub Desktop.
Automater script to open VIM with Finder.app
on run {input}
set the_path to POSIX path of input
-- run vim command and exit Terminal.app after close
set cmd to "vim " & quoted form of the_path & "; exit"
tell application "System Events" to set terminalIsRunning to exists application process "Terminal"
tell application "Terminal"
-- Open new Tab if Terminal.app is already running
if terminalIsRunning is true then
activate
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
end if
do script with command cmd in window 1
-- Be sure Terminal.app is active after open vim
activate
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment