Skip to content

Instantly share code, notes, and snippets.

@erikson1970
Forked from keith/SpawniTerm.applescript
Created July 22, 2022 19:37
Show Gist options
  • Save erikson1970/d54e553b9397d1a3d0151bb91317e504 to your computer and use it in GitHub Desktop.
Save erikson1970/d54e553b9397d1a3d0151bb91317e504 to your computer and use it in GitHub Desktop.
Spawn a new iTerm window in the pwd
on run argv
tell application "iTerm"
set t to make new terminal
tell t
activate current session
launch session "Default Session"
tell the last session
write text "cd \"" & item 1 of argv & "\"; clear; pwd"
end tell
end tell
end tell
end run

Add this to your .aliases with:

function spawn { osascript ~/Dropbox/Code/Applescript/Spawn/SpawniTerm.applescript $PWD }

Changing the ~/Dropbox/Code/Applescript/Spawn/SpawniTerm.applescript appropriately. Then run spawn from the command line.

Created with help from:

http://stackoverflow.com/questions/4438147/alias-with-variable-in-bash
http://hints.macworld.com/article.php?story=20050523140439734
http://superuser.com/questions/283418/how-can-i-make-terminal-vim-my-default-editor-application-in-mac-os-x/283422#283422
https://gist.github.com/1769355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment