Home Download Buy Blog Forum Support

Windows: Can't set SB3 as default text editor

Windows: Can't set SB3 as default text editor

Postby an.eireann on Sun Mar 10, 2013 3:37 pm

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.
an.eireann
 
Posts: 8
Joined: Wed Jan 02, 2013 7:17 am

Re: Windows: Can't set SB3 as default text editor

Postby robertcollier4 on Sun Mar 10, 2013 3:46 pm

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: Select all
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"


2. This adds Sublime Text to the right click context menu for files of all types:
Code: Select all
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell]
@="Sublime"

[HKEY_CLASSES_ROOT\*\shell\Sublime]
@="&Sublime"

[HKEY_CLASSES_ROOT\*\shell\Sublime\command]
@="\"D:\\PortableApps\\SublimeText\\sublime_text.exe\" \"%1\""
robertcollier4
 
Posts: 121
Joined: Sun Feb 24, 2013 5:37 pm

Re: Windows: Can't set SB3 as default text editor

Postby an.eireann on Sun Mar 10, 2013 4:03 pm

Thanks Robert. That solution is better than what I wanted. How would one set highlighting options for different file types? :D
an.eireann
 
Posts: 8
Joined: Wed Jan 02, 2013 7:17 am

Re: Windows: Can't set SB3 as default text editor

Postby an.eireann on Sun Mar 10, 2013 4:27 pm

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:

Image

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\.
an.eireann
 
Posts: 8
Joined: Wed Jan 02, 2013 7:17 am

Re: Windows: Can't set SB3 as default text editor

Postby an.eireann on Sun Mar 10, 2013 4:53 pm

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: Select all
    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
 
Posts: 8
Joined: Wed Jan 02, 2013 7:17 am

Re: Windows: Can't set SB3 as default text editor

Postby robertcollier4 on Sun Mar 10, 2013 5:23 pm

@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 <args>" is called it will call "<debugger> notepad.exe <args>". 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: Select all
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\SublimeFile\shell]
@="edit"

[HKEY_CLASSES_ROOT\SublimeFile\shell\edit\command]
@="\"D:\\PortableApps\\SublimeText\\sublime_text.exe\" \"%1\""

[HKEY_CLASSES_ROOT\SublimeFile\DefaultIcon]
@="\"D:\\PortableApps\\SublimeText\\sublime_text.exe\",0"


Then go to regedit - HKEY_CLASSES_ROOT\.ext (where ext is the extension you want to associate) - and change the (Default) value to SublimeFile.
robertcollier4
 
Posts: 121
Joined: Sun Feb 24, 2013 5:37 pm

Re: Windows: Can't set SB3 as default text editor

Postby an.eireann on Mon Mar 11, 2013 2:25 pm

I found the problem. It has to do with sublime messing up the registry. Details here.
an.eireann
 
Posts: 8
Joined: Wed Jan 02, 2013 7:17 am


Return to Technical Support

Who is online

Users browsing this forum: aziz, Google [Bot] and 9 guests