使用命令行在行号处打开 sublime 文本文件

Open sublime text file at a line number using command line

我正在尝试使用 sublime text 3 打开一个文件,我想用光标在具体的行号处打开它。

我一直在检查 subl --help,但找不到具体线路的选项。因此我只是使用: subl filename

有没有办法做到这一点?

您可以使用:line在指定行打开:

subl file.txt:345

在我的 sublime-text 3 版本中,subl --help 确实给我指示(最后一行):

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.