Created
June 18, 2013 06:32
-
-
Save ikuyamada/5803088 to your computer and use it in GitHub Desktop.
A short zshrc snippet that creates new tab on executing ssh in iTerm 2
This file contains hidden or 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
ITERM_SESSION_NAME=Default | |
if [ $TERM_PROGRAM = "iTerm.app" ]; then | |
function new_tab() { | |
osascript\ | |
-e "tell application \"iTerm\""\ | |
-e "tell the first terminal"\ | |
-e "launch session \"${ITERM_SESSION_NAME}\""\ | |
-e "tell the current session"\ | |
-e "write text \"$1\""\ | |
-e "set name to \"$2\""\ | |
-e "end tell"\ | |
-e "end tell"\ | |
-e "end tell"\ | |
2> /dev/null | |
} | |
function ssh_iterm() { | |
new_tab "clear; /usr/bin/ssh $@; exit" "$@" | |
} | |
alias ssh=ssh_iterm | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment