Skip to content

Instantly share code, notes, and snippets.

@cinakyn
Created October 29, 2019 05:07
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save cinakyn/a965c695b5d95def68ee84eb3d36befa to your computer and use it in GitHub Desktop.
Save cinakyn/a965c695b5d95def68ee84eb3d36befa to your computer and use it in GitHub Desktop.
Open files with iTerm vim
-- 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
Copy link

ghost commented Feb 21, 2020

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment