Sublime Forum

Windows: Can't set SB3 as default text editor


I go to

Open With > Choose Default Program > Browse > C:\Program Files (x86)\Sublime Text 3\sublime_text.exe > Open

but Sublime Text does not appear on the menu, so I have to select of the others as the default, then click OK.



If you can’t find the app on the list, there is usually a “Browse” button that lets you find the EXE on your hard drive.

Also, here are the registry scripts I use for Sublime Text on my system. To use, create files with the .REG extension containing the following text, modify the path to your location of the EXE - then right click on the .REG file and Merge.

  1. This replaces all calls to Notepad.exe with Sublime Text:

[code]Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Notepad.exe]
“Debugger”="“D:\PortableApps\SublimeText\sublime_text.exe” -z"

  1. This adds Sublime Text to the right click context menu for files of all types:

[code]Windows Registry Editor Version 5.00



@="“D:\PortableApps\SublimeText\sublime_text.exe” “%1"”[/code]



Thanks Robert. That solution is better than what I wanted. How would one set highlighting options for different file types? :smiley:



Robert, this doesn’t work on Windows XP (the notepad replacement, that is). Here is the result when I “Open With… Notepad” on my Windows XP laptop:

A bunch of new files open in SB. It works fine on Windows 7 (as I mentioned in my last post).

PS: There is no such folder …\My Documents\Documents, the file I was trying to open was in …\My Documents.



As well as all the new files, SB3 opens notepad.exe as a text file (see the leftmost tab in the above screenshot). This is the code I’m using:

[code] Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Notepad.exe]
"Debugger"="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\""




@an.eireann - I also use Windows XP.

  1. To not have Sublime open notepad.exe as a text file - you have to use the -z switch when using that Debugger registry key as shown in my previous post. That is because you are technically telling Windows to use sublime_text as the debugger so that when "notepad.exe " is called it will call " notepad.exe ". The “-z” switch was added by the developer to ignore the first argument as posted here by jps.

  2. The reason you are getting separate tabs for Documents, and, My - is because %1 is being launched from the registry in Windows XP without quotes around it - and so paths with spaces in the name are being interpreted as multiple files. You just need to add the quotes around the %1 argument. To fix this - go to regedit - search the registry for all instances of notepad.exe %1 and replace it with notepad.exe "%1"

Really, the better way to solve #2 - instead of using the “Open With” dialog box - associate the extension yourself in the registry. First create a SublimeFile class type with the following registry script:

[code]Windows Registry Editor Version 5.00


@="“D:\PortableApps\SublimeText\sublime_text.exe” “%1"”


Then go to regedit - HKEY_CLASSES_ROOT.ext (where ext is the extension you want to associate) - and change the (Default) value to SublimeFile.



I found the problem. It has to do with sublime messing up the registry. Details here.