很多答案都展示了如何从命令行使用 Sublime Text。但我发现自己想从命令行打开一个新的 Sublime Text“无标题”选项卡。
Sublime 中的此选项卡尚未与磁盘上的文件关联。基本上,就像在 Sublime Text 已运行时使用Ctrl+一样。N
答案1
从subl --help
:
Sublime Text build 3095
Usage: subl [arguments] [files] edit the given files
or: subl [arguments] [directories] open the given directories
or: subl [arguments] - edit stdin
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
-s or --stay: Keep the application activated after closing the file
-h or --help: Show help (this message) and exit
-v or --version: Show version and exit
--wait is implied if reading from stdin. Use --stay to not switch back
to the terminal when a file is closed (only relevant if waiting for a file).
Filenames may be given a :line or :line:column suffix to open at a specific
location.
因此,只需使用subl -n
(或--new-window
)打开一个带有空选项卡的新窗口即可。如果您不想打开新窗口,请使用
subl --command new_file
在现有窗口中打开一个空白选项卡。