I'm trying to open a file using sublime text 3, and I would like to open it with the cursor at a concrete line number.
I've been checking subl --help
but I could find no option for a concrete line. Therefore I'm just using:
subl filename
Is there any option to do it?
Open any program file in the sublime editor and Right-click (context menu). You can see the Cmd menu in the Context menu options. Click on it. The command prompt will be opened through which you can compile and run your program.
Just hit Ctrl + G , and it does the same steps for you!
If you want to open the file file. txt with Sublime Text from the command line, the command open -a "Sublime Text" file. txt may be better suited.
Sublime Text includes a command-line helper called subl . Using the command-line helper, you can open files and folders and perform other actions from the command line. Before using subl , make sure it is on your PATH . To put subl on your PATH , you may need to add directories to PATH or use symbolic links.
You can use :line
to open at the given line:
subl file.txt:345
In my version of sublime-text 3, subl --help
does give me the indication (last line):
subl --help
Sublime Text build 3143
Usage: sublime_text [arguments] [files] edit the given files
or: sublime_text [arguments] [directories] open the given directories
Arguments:
--project <project>: Load the given project
--command <command>: Run the given command
-n or --new-window: Open a new window
-a or --add: Add folders to the current window
-w or --wait: Wait for the files to be closed before returning
-b or --background: Don't activate the application
-h or --help: Show help (this message) and exit
-v or --version: Show version and exit
Filenames may be given a :line or :line:column suffix to open at a specific location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With