-
-
Save nick-kadutskyi/37259d6fc87af0c12fe579a398977f2c to your computer and use it in GitHub Desktop.
open file with vim in iTerm2 by double click
This file contains 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 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