This is a little helper script for BBEdit to make View > Go Here in Terminal use iTerm2 instead of Terminal.app. You can't simply give BBEdit iTerm2's bundle ID directly because iTerm2 doesn't respond to the open instruction from BBEdit, for unknown reasons.
It's based on this pastebin which in turn was based on rwilcox/open_here.applescript. It differs from both of these in that it will open a new tab in the frontmost iTerm2 window if there is one, rather than always creating a new window.
To install, open the .scpt
file in AppleScript Editor. Run it to check it works, if you want. Then File > Export…, choose File Format "Application", and tick "Run-only".
You'll get an application called “Go here in iTerm2.app”. Put this somewhere suitable. /Applications/Utilities
is a good choice.
Then from the command line issue this command:
defaults write com.barebones.bbedit TerminalBundleID -string "com.apple.ScriptEditor.id.Go-here-in-iTerm2"
If you changed the filename, you'll need to replace com.apple.ScriptEditor.id.Go-here-in-iTerm2
with whatever the new bundle ID is.