Question

If I open ~/foo.txt then open ~/baz/bar.txt from Terminal, Sublime Text always opens 2 different windows. It's aggravating to have all these different windows open..

I've tried changing a bunch of ST's settings, but nothing seems to fix this.

Is there a way to have ALL files and folders just open up in the same window as if I were manually adding all these folders to the project?

Was it helpful?

Solution

In Sublime Text Menu:

Preferences ->  Settings - User

Look for 'open_files_in_new_window'

And change 'true' with 'false'

OTHER TIPS

Rather than editing the SublimeText default settings (as Jahnux73 suggested), you should go to Preferences -> Settings - User, and add the following:

"open_files_in_new_window": false,

The SublimeText default settings file should not be modified, as it may be overwritten by Sublime updates, and so that you'll always be able to restore the default settings. The way Sublime works is that at runtime, it reads and applies the default settings, and then reads and applies the Settings - User file. In the event of a conflict, the User settings take precedence. That way, you can add your own settings without modifying the default configs.

Drag files or directories to sublime window will add them to current window instead of opening new one.

Folder can be directly dragged to sidebar, or from menu bar select

  • Project --> Add Folder to Project.

And better, since this has the same functionality as File -> Open folder which isn't mapped to a shortcut by default. You can make this a key mapping by going to

File -> Preferences -> Key bindings and append

{ "keys": ["ctrl+shift+o"], "command": "prompt_add_folder" },

then you can use CTRL+SHIFT+O to add a folder.

All the answers above indicate the parameter files only, but this does not work for folders. I found this solution:

  1. You need to go to the registry path HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3\command
  2. Change command add the parameter -a, get: C:\Program Files\Sublime Text\sublime_text.exe "%1" -a

  • Also, if You have a custom alias for the console, you can use it like this: subl . -a

For mac OS two changes are needed

1- Preferences -> Settings - User

Look for 'open_files_in_new_window'

And change 'true' with 'false'

2-

In system Preferences find the Dock and then change its setting for the option “Prefer tabs when opening documents” and choose Always.

Then do :

subl folder_1

subl folder_2

subl folder_3

I explained in details here

enter image description here

All those replies above didn't work. Here I found the real solution to this problem: -

Click Preferences

 > Settings - Distraction Free

Then add these lines in user panel:
"open_files_in_new_window": false,

And click Save.

Here you go!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top