Sublime Forum

New instance of Sublime Text

#1

If I launch a file in Sublime Text from the terminal, it uses the current instance of Sublime Text if one is running. But if I type subl . to open all files in a directory, it launches a new instance. I would like to know the rationale for this behavior and whether it can be changed?

0 Likes

#2

Do you mean a new application instance or a new window? Only one instance of ST should ever be running, but it can have many windows.

0 Likes

#3

I suppose then I meant new Window instance.

0 Likes

#4

If you do subl --help to see the command line help, it starts as:

Usage: subl [arguments] [files]         Edit the given files
   or: subl [arguments] [directories]   Open the given directories
   or: subl [arguments] -- [files]      Edit files that may start with '-'
   or: subl [arguments] -               Edit stdin
   or: subl [arguments] - >out          Edit stdin and write the edit to stdout

The name ., by os/shell convention, is the current directory, so subl . is telling Sublime to open the current directory.

If you want to open all of the files in the current directory, you want subl * instead.

Files always open in the currently active window; use subl -n * if you want to create a new window and open the files in it instead.

2 Likes