Shortcut / "Open with Sublime Text" in a new Sublime window

I am looking for a way to right-click a file in Windows 10, select “Open with” → “Sublime Text”, and then open a new Sublime Text window.

The default action is to open the file in a new tab if Sublime is already open. This is usually not what I want, especially since I usually have Sublime open on another desktop.

I tried making a shortcut with the -n flag added, which correctly gives me a new window, just using the shortcut. But when I open with this shortcut, it opens the file in an existing window.

I also tried "Open with" a batch file containing subl -n , ``, but alas.

+5
source share
2 answers

This works for me (and is more convenient for me than Open with a submenu):

  • Open regedit.exe
  • go to HKEY_CLASSES_ROOT\*\shell
    To apply this only to certain file types, replace * with the appropriate extension
  • Add the key "Open with sublime in a new window"
  • Inside this add a new command
  • Inside the "command" set the line (Default) for:
    C:\Program Files\Sublime Text 2\sublime_text.exe -n "%1"

(basically copy the source keys by adding -n )

  1. Additionally:
    Inside the "Open with elevated in new window" key, add a line called Icon :
    C:\Program Files\Sublime Text 2\sublime_text.exe,0
    This will add the Sublime Text icon to the left of the command in the context menu.

To add entries to the context menu for folders, add the same entries to:

  • HKEY_CLASSES_ROOT \ Folder \ wrappers
    For the context menu when you click on the folder icon
  • HKEY_CLASSES_ROOT \ Directory \ Background \ Shells
    For the context menu when clicking on the folder background
+6
source

Open the settings, then add the following line between {}:

 "open_files_in_new_window": false 
0
source

Source: https://habr.com/ru/post/1236296/


All Articles