Last Updated: February 25, 2016
· piotrj

Quickly open files in iTerm with Cmd+Click

If you're using iTerm then here is a very useful feature:

When you press Command then your mouse pointer goes into special mode - click anything and it performs some action on the clicked object. I've found it most useful to quickly open files. For example, you get an exception backtrace:

/my_app/app/models/user.rb:72:in `generate_slug'
/my_app/app/modesl/user.rb:7:in `block in change'

You can quickly see where the exception occured with command clicking on particular elements of the backtrace and the given file will pop up opened in your editor and focused on the line in question. I guess the default editor is MacVim which is fine for me but you may edit the behavior by going to Preferences->Profiles->Advanced->Semantic History.


4 Responses
Add your response

Mvim works great. It doesn't work for Sublime Text 2, but maybe I'm missing something

over 1 year ago ·

Yeah, it seems like SublimeText doesn't work. But you may do workaround by choosing Run command and typing /path/to/your/subl \1:\2

over 1 year ago ·

Thanks very much sir!

over 1 year ago ·

If you are having issues try adding "${PWD/#$HOME/~}\007" to your PS1, this will help iTerm interpret relative paths correctly.

over 1 year ago ·