- In iTerm2, go to Settings -> Profiles -> Advanced -> Smart Selection -> Edit
- Click
+
to add a rule with the following values:- Notes: Python traceback
- Regular Expression:
File "(.+)", line ([0-9]+), in .+
- Precision: Very High
- Click
Edit Actions...
and add an action to open in your editor. For example, if you use VS Code, add an action with the following values:- Title: Open in VS Code
- Action: Run Command...
- Parameter:
/usr/local/bin/code -r -g "\1":\2
- Cmd+Click any location in the traceback to open the corresponding line directly in your editor. (Don't click the actual filename, click anywhere else on the same line.)
-
-
Save SteveAlexander/2c635e5dff107a4ca0a1713fe7d513f7 to your computer and use it in GitHub Desktop.
Easily open files from Python tracebacks in iTerm2 directly in your editor
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment