Last active
March 27, 2018 19:12
-
-
Save swdunlop/6908ccfb3464e46262cecdc69d5b953c to your computer and use it in GitHub Desktop.
Split the Current iTerm2 Session to Run a Command
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
#!/usr/bin/osascript | |
on run argv | |
tell application "iTerm2" | |
tell current session of current window | |
set view to split horizontally with default profile command "sh -c " & (quoted form of item 1 of argv) | |
select view | |
end tell | |
end tell | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have seen variations of this script elsewhere involving writing to the session, which can result in various forms of derp. It's easier to just provide the command to iTerm2 when you create the new view. I use this for things like
iterm ~/bin/fzf-notes
, which uses fzf to launch an editor.