Above, Below, and Beyond Tech Talk

by Rahel Lüthy

February 8, 2012

IntelliJ IDEA: Reveal in Terminal

IntelliJ IDEA ships with a very handy Reveal in Finder action, but unfortunately, I am still a terminal person. Today I put together a tiny AppleScript which creates a new iTerm2 session and changes to a directory of choice:

on run dir
  tell application "iTerm"
    tell last terminal
      set mysession to (make new session at the beginning of sessions)
      tell mysession
        set name to "Default"
        exec command "/bin/bash -l"
      end tell
      tell mysession
        write text "cd " & dir
      end tell
    end tell
  end tell
end run

IDEA allows to add custom actions via Settings » External Tools. Save the above script to a file (e.g. launchTerminalAndChangeDir.scpt) and configure a new Reveal in Terminal action as follows:

Additionally, you may want to associate a key binding via Settings » Keymap. I chose Ctrl-Shift-T, which seems intuitive and is not conflicting with any OSX defaults.