Skip to content

Instantly share code, notes, and snippets.

@nick-kadutskyi
Forked from CoderPiF/VimLauncher.scpt
Created November 10, 2022 03:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nick-kadutskyi/37259d6fc87af0c12fe579a398977f2c to your computer and use it in GitHub Desktop.
Save nick-kadutskyi/37259d6fc87af0c12fe579a398977f2c to your computer and use it in GitHub Desktop.
open file with vim in iTerm2 by double click
on run {input, parameters}
set the_path to POSIX path of input
set cmd to "vim '" & the_path & "'"
set isRunning to (application "iTerm" is running)
tell application "iTerm"
activate
if isRunning then
if (count of windows) > 0 then
set sess to (current session of (create tab with default profile of current window))
else
set sess to (current session of (create window with default profile))
end if
else
repeat until (exists current window)
delay 0.1
end repeat
set sess to (current session of current window)
end if
tell sess
write text cmd
end tell
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment