崇高的命令行打开它两次

Ger*_*rep 3 sublime-text

我刚刚创建了一个指向 sublime 的符号链接:

$ sudo ln -s /opt/SublimeText2/sublime_text /usr/bin/subl
Run Code Online (Sandbox Code Playgroud)

问题是它打开了最后一个项目和我想要的打开:

$ subl my-project
Run Code Online (Sandbox Code Playgroud)

或者

$ ~/my-project/subl .
Run Code Online (Sandbox Code Playgroud)

这两个命令都打开 Sublime Text 2 但两次,所以我有两个 ST2 正在运行。

如何解决这个问题?

Яро*_*лин 6

$ ./sublime_text --help 
Sublime Text 2 Build 2217

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
Run Code Online (Sandbox Code Playgroud)

您可以通过提供“-a”选项来获得所需的效果,该选项会将文件夹树发送到正在运行的应用程序实例,而不是打开一个新窗口。