Skip to content

Instantly share code, notes, and snippets.

@bobrocke
Last active July 8, 2016 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobrocke/91c367189ebbb2f2741e2e79e5072bb3 to your computer and use it in GitHub Desktop.
Save bobrocke/91c367189ebbb2f2741e2e79e5072bb3 to your computer and use it in GitHub Desktop.
An AppleScript to open iTerm2 at the file system location of the selected file or folder in BBEdit.
tell application "BBEdit" to set theFile to file of document 1
tell application "Finder" to set theFolder to (container of file theFile) as alias
set theUnixPath to POSIX path of theFolder
tell application "iTerm"
activate
tell current window
close
end tell
tell (create window with profile "Default")
tell current session
write text "pushd \"" & theUnixPath & "\"" & "&& clear"
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment