Created
November 12, 2015 19:53
-
-
Save mstroeck/f06753dce2c06200692d to your computer and use it in GitHub Desktop.
Use Applescript to launch files in vim via iTerm
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, parameters} | |
set cmd to "vim -c startinsert" | |
if input is not in {} then | |
set myPath to POSIX path of input | |
set cmd to "vim " & quote & myPath & quote | |
end if | |
tell application "iTerm" | |
activate | |
set myTerm to (current terminal) | |
try | |
tell myTerm | |
set mySession to (make new session at the end of sessions) | |
tell mySession to exec command cmd | |
end tell | |
on error | |
set myTerm to (make new terminal) | |
tell myTerm | |
set mySession to (make new session at the end of sessions) | |
tell mySession to exec command cmd | |
end tell | |
end try | |
end tell | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment