Created
May 22, 2016 13:38
-
-
Save brake/197b42594f2ee81cf647929eddde52e7 to your computer and use it in GitHub Desktop.
Open a new iTerm2 tab with folder selected in Finder. If iTerm was not previously started - starts it.
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
| -- Stefan van den Oord, 2010-12-29 | |
| -- Constantin Roganov 2015-06-27 | |
| -- The "cd to" command for iTerm2 (added: opening in new tab of iTerm 2 | |
| tell application "Finder" | |
| set _cwd to POSIX path of ((folder of (front window)) as alias) | |
| end tell | |
| tell application "iTerm" | |
| activate | |
| try | |
| set _term to «class Ctrm» | |
| on error | |
| set _term to (make new «class Ptrm») | |
| end try | |
| tell _term | |
| «event ITRMLNCH» given «class Pssn»:"xterm" | |
| set _session to «class Cssn» | |
| end tell | |
| tell _session | |
| «event ITRMWrte» given «class iTxt»:"pushd \"" & _cwd & "\"" | |
| end tell | |
| end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment