如何从 Linux 中的命令行打开 Sublime Text 2 文件到选项卡,而不是新窗口

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12224904/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 14:14:03  来源:igfitidea点击:

How can I open Sublime Text 2 files from the command line in linux to a tab, not a new window

linuxubuntusublimetext2

提问by phirschybar

I have ST2 setup so that I can do 'sublime file.txt' and it will open in a ST2 window. But how can I make it open in a new tab in the currently open window?

我有 ST2 设置,所以我可以做“sublime file.txt”,它会在 ST2 窗口中打开。但是如何在当前打开的窗口中的新选项卡中打开它?

采纳答案by Mikko Ohtamaa

Try Sublime command line help

试试 Sublime 命令行帮助

subl --help Sublime Text 2 Build 2217

subl --help Sublime Text 2 Build 2217

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.

After you have opened a new window the subsequent files should be added there as per the default behavior.

打开新窗口后,应根据默认行为在其中添加后续文件。

回答by Francois

This works on Ubuntu 12.04:

这适用于 Ubuntu 12.04:

subl filename

or

或者

subl -n filename(if you want it to open in a seperate window)

subl -n filename(如果您希望它在单独的窗口中打开)

回答by Zabe Sangary

another option is: to open file.

另一种选择是:打开文件。

[sublime index.html script.js styles.css]

to open a folder [ sublime folderName ]

打开一个文件夹 [ sublime folderName ]

回答by Arun Kasyakar

subl fileName

and if you want to open a new file use

如果你想打开一个新文件使用

subl -n new_file_name