Skip to content

Instantly share code, notes, and snippets.

@mstroeck
Created November 12, 2015 19:53

Revisions

  1. mstroeck created this gist Nov 12, 2015.
    24 changes: 24 additions & 0 deletions vim-launcher.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    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