Sublime Forum

Jump to open file from command line

#1

Hi,

from reading the docs and the forum, I know how to use subl (on Mac) to open files and jump to line numbers.

If a file is already open in ST, how can I activate (and not open an additional tab/window) the open file and jump to then given line number?

Use case is debugging python code, where I could jump to the given line number of the (already) open file where the error occurred.

0 Likes

#2

You can just use the Goto Line feature of ST. From the main menu, go to Goto -> Goto Line ... and just type the line number.

0 Likes

#3

Sure, I know how to do that.

I’d like to skip / automate this by just having to click on the error message. So this would need to be a feature of subl or calling ST directly…

(The creating and handling of the hyperlink is covered, I need to know how to call subl to not open another window/tab)

0 Likes

#4

Build systems allow you to specify a regex for file/line/column allowing you to double click on those to go there. subl will also generally reuse open files unless you’ve changed settings like "open_files_in_new_window".

0 Likes

#5

I’m not using build systems (in this case), because I need to use the interactive python console for debugging, which didn’t work “inside” ST.

In the settings, “open_files_in_new_window” is set to false; this seems to work sometimes, and sometimes not. Guess I need to take a closer look at symlinks in the path…

Thanks so far!

0 Likes