2

I have configured this in the past, and sometimes it works...or not with various linting tool printouts. For example, some file output might be:

foobar/thisorthat/thing.py:123

And if it prints out on the command line, a [CMD] + [MOUSE_CLICK] will open that file as if it is a hyperlink in the configured text editor default for that filetype.

Other times, the OS will interpret the string as a hyperlink and try to open it in the browser window (this is not the goal).

My question amounts to: how would I modify the output string:

# full question
foobar/thisorthat/thing.py:123

# simplification that still gets it done
foobar/thisorthat/thing.py

So that the [CMD]+[MOUSE_CLICK] mechanic opens the file with the text editor rather than the browser?

3
  • The “required format for file paths”? They are either POSIX or alias delimited. What angle are you trying to approach this from? I’m guessing Applescript/Automator service? Can you edit with some clarifications and how you approached this? Please help us by narrowing and focusing this question.
    – Allan
    Mar 24 at 19:57
  • @Allan I am CMD-Clicking plaintext terminal output in iterm2's terminal
    – Chris
    Mar 24 at 20:03
  • @Allan the reason I ask is this worked last year, so I figure it can be configured to open strings as files rather than only as urls when CMD-Clicking
    – Chris
    Mar 24 at 20:07

1 Answer 1

1

Define this Semantic History; found in iTerm's Profiles .

In the Profile editor, under Advanced → Semantic History, you can select the application that launches when you select and ⌘ Command Click. Since this is profile specific, you can define different ⌘ Command Click actions for each separate profile: VS Code for Work, Atom for Home, BBEdit for Linux, etc.

iTerm2 Semantic History

Just choose your action (Open with Editor) and select the editor you wish to use and it will open the file as expected.

6
  • great! thanks. got it worked out -- although I am not sure how to un-gray the options in the editor section, I configured it to open with the default application.
    – Chris
    Mar 24 at 20:45
  • I believe you have to install them. Mine just show up automatically.
    – Allan
    Mar 24 at 20:47
  • ah, I have many installed but none are un-grayed. I installed them via Jetbrains' toolkit, so that might be the issue.
    – Chris
    Mar 24 at 20:50
  • Possibly. Try installing another (and remove if so needed) just to see if it gets populated.
    – Allan
    Mar 24 at 20:56
  • 1
    That might be good (new) question to ask!
    – Allan
    Mar 24 at 23:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .