Last active
June 20, 2016 20:54
-
-
Save burke/7b42db0b6cc0828d462f79b4a5108cdf to your computer and use it in GitHub Desktop.
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
-- compiled from https://github.com/janko-m/vim-test/tree/master/bin | |
on run argv | |
set command to argv | |
-- without doing this as a var, it will launch iterm2 | |
set iterm to "iTerm2" | |
if application iterm is running then | |
tell application "iTerm" | |
set _window to (current window) | |
if _window is equal to missing value then | |
create window with default profile | |
end if | |
tell current window | |
tell current session | |
write text (item 1 of argv) | |
end tell | |
end tell | |
end tell | |
else | |
tell application "Terminal" | |
if (count of windows) is 0 then | |
do script command | |
else | |
if window 1 is busy then | |
activate | |
tell application "System Events" to keystroke "t" using {command down} | |
repeat while contents of selected tab of window 1 starts with linefeed | |
delay 0.01 | |
end repeat | |
do script command in selected tab of window 1 | |
else | |
do script command in window 1 | |
end if | |
end if | |
activate | |
end tell | |
delay 0.02 | |
end if | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment