My question is similar to the thread in SublimeHQ forum.
I have added some entries in my Default.sublime-commands file to open files, e.g.
{ "caption": "File Open: File Name", "command": "open_file", "args": {"file": "/path/to/file.ext"} }, They work fine but I’d like one of them to open at a specific line number and can’t find the right notation.
This does NOT open the file at line 123, instead it opens the file path: /path/to/file.ext:123.
{ "caption": "File Open: File Name", "command": "open_file", "args": {"file": "/path/to/file.ext:123"} }, They suggested:
Try adding “flags” : 1 to the argument list. The API open_file need to have the flag ENCODED_POSITION to extract the line/column from the file name, maybe it is the same.
{ "caption": "File Open: File Name", "command": "open_file", "args": {"file": "/path/to/file.ext:123", "flags":1} }, But this also failed.
In sublime.py
def open_file(self, fname, flags=0, group=-1): open_file(file_name, <flags>) But in the args key we use file and not file_name & fname .
Where it is stated?
How to do this without creating a new plugin?
colit can be omitted (same goes for therowbut that would be self-defeating.open_filecommand and the APIopen_filecommand are NOT the same thing despite having the same name. In all probability the nativeopen_filecommand takes only 1 arg, the file path. One of the great things about Sublime Text is when you need extra or different functionality you can usually write a plugin to provide it; in this case the plugin took me only a few minutes to write and is just 4 lines of code.