Created
October 29, 2019 05:07
-
-
Save cinakyn/a965c695b5d95def68ee84eb3d36befa to your computer and use it in GitHub Desktop.
Open files with iTerm vim
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
-- forked version of https://gist.github.com/charlietran/43639b0f4e0a01c7c20df8f1929b76f2 | |
on run {input, parameters} | |
set paths to "" | |
repeat with i from 1 to length of input | |
set cur to item i of input | |
set paths to paths & " " & quote & POSIX path of cur & quote | |
end repeat | |
set cmd to "vim -p" & paths | |
tell application "iTerm" | |
set created to false | |
if not (exists current window) then | |
create window with profile "Default" | |
set created to true | |
end if | |
tell current window | |
if not created then | |
create tab with profile "Default" | |
end if | |
tell current session | |
activate | |
write text cmd | |
end tell | |
end tell | |
end tell | |
end run | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍