on run argv set CR to ASCII character of 13 set ESC to ASCII character of 27 set filename to (item 1 of argv) set lineNum to (item 2 of argv) tell application "Vim" to activate tell application "System Events" tell process "Vim" keystroke ESC & ":set hidden" & CR keystroke ":if bufexists('" & filename & "')" & CR keystroke ": buffer " & filename & CR keystroke ":else " & CR keystroke ": edit " & filename & CR keystroke ":endif" & CR keystroke ":" & lineNum & CR keystroke "zO" -- open folds, if any exists. end tell end tell end run