Last active
April 6, 2018 14:43
-
-
Save youzi/8624acaff807ba95a1935de6fe8993a8 to your computer and use it in GitHub Desktop.
Open input file in active vim session or new vim session in iTerm
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
tell application "iTerm" | |
try | |
repeat with termWindow in windows | |
tell termWindow | |
repeat with termTab in tabs | |
tell termTab | |
repeat with termSession in sessions | |
tell termSession | |
if name contains " vim " then | |
write text ":e " & POSIX path of input | |
activate | |
tell termWindow | |
select | |
end tell | |
tell termTab | |
select | |
end tell | |
select | |
return | |
end if | |
end tell | |
end repeat | |
end tell | |
end repeat | |
end tell | |
end repeat | |
end try | |
create window with default profile | |
tell front window | |
tell current session | |
write text "vim " & quote & POSIX path of input & quote | |
end tell | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment