As mentioned elsewhere I’ve totally fallen in love with Sublime Text 2 as an editor. One of the issues I’ve had switching to using it on Windows, though, is the muscle memory I’ve developed for selecting the “Edit With Notepad++” contextual menu option. I think part of the reason I’m having trouble switching is that the Notepad++ item has an icon and, by default, the Sublime Text 2 item does not. Several weeks ago I figured out how to add an icon to the Sublime Text 2 item and it has definitely reduced the number of times I’ve accidentally chosen Notepad++. Better write it down before I forget how I did it…
The basics of what I did were taken from a forum posting which ultimately yielded the information I was looking for, but which presented commands I wasn’t prepared to run unvetted, and presented several different possible actions to take without being obvious which ones ended up being “correct”.
For full disclosure, the steps below worked for me on a Win7 x86_64 machine.
If I were to distill the action I took into a single command, ala the ones presented in the forum, it would be this:
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "C:\Program Files\Sublime Text 2\sublime_text.exe,0"
In truth though I was too chicken to run that actual command without fully understanding what I was doing. So here are the actual steps I took to add the icon:
- run `regedit` (windows-R -> “regedit” -> enter)
- Find (ctrl-F) “Open with Sublime Text 2”.
- On my machine there were two results, one in HKEY_CLASSES_ROOT and one in HKEY_LOCAL_MACHINE. Based on the discussion in the forum post above I chose to use the one in HKEY_LOCAL_MACHINE
- Find the path to the executable being referenced by clicking on the “command” key under HKEY_LOCAL_MACHINE. It’s the “Data” portion of the Default key, minus the %1.
- On my machine it was “C:\Program Files\Sublime Text 2\sublime_text.exe”
- Add new key:
- select “Open with Sublime Text 2”
- Choose the Edit->New->Expandable String Value menu item
- Change name of new entry to “Icon”
- Right click new value, select modify
- Enter the value you picked up from the command key into the “Value data” field, with “,0” added to the end
- Example: “C:\Program Files\Sublime Text 2\sublime_text.exe,0”
- Click “OK”
- Exit regedit
After those steps, you should have an Icon next to the “Edit with Sublime Text 2” contextual menu item, like so: