Created
July 6, 2014 14:22
-
-
Save drscream/0d2b7030b51ad6640798 to your computer and use it in GitHub Desktop.
Automater script to open VIM with Finder.app
This file contains hidden or 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
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