Sublime Forum

Open files in new window in windows 10

#1

I am unable to do this.
Basically if I double click any text file on my computer I want it to open in a new instance of sublime text 3.
I want this because I am using multiple desktops in windows 10 and if the file opens in the same instance of sublime text 3 windows 10 takes me to that desktop.
I tried to go to user settings and typing in “open_files_in_new_window”:true, and this did not work.

Please help!

0 Likes

#2

ok so the answer so far i got was to do
C:\Program Files\Sublime Text 3\subl.exe -n

the -n argument is what i need to add to open a new instance of sublime text 3
got this from
superuser

0 Likes

#3

According to the text in the default settings file, that option only works under OS X, so that’s probably why it’s not working for you:

    // OS X only: When files are opened from finder, or by dragging onto the
    // dock icon, this controls if a new window is created or not.
    "open_files_in_new_window": true,

Sublime has a command line option “-n” that gets it to open in a new window, so a command similar to the following makes it open a new window for the file (or directory, if you give it one) that you specify, even if there is already an existing window.

"C:\Program Files\Sublime Text 3\sublime_text.exe" -n "myFilename.txt"

The trick is actually getting at the internals of windows so that it will actually do that for you. Back in the Windows XP days, the explorer had a File Types configuration system that let you edit exactly how commands operate. Starting with Windows 7 (and thus presumably Windows 8 and then 10) the ability for the user to change that setting easily was removed.

IF you’re comfortable with editing the registry using Regedit, you can use that to find the appropriate key and insert a -n in between sublime executable here and "%1" (intentionally vague because editing the registry is dangerous if you don’t know what you’re doing).

Similarly, you can use the console commands ftype and assoc from an elevated command prompt to do the dirty work, which again you should probably not mess with if you’re not confident in how they operate.

When in doubt, there are apparently third party applications that you can use to change these settings although I’ve never used anything like that so I can’t say if any one is particularly better or worse than any other.

3 Likes

#4

Whoop, you beat me to the punch on that one. :slight_smile:

0 Likes