Sublime Forum

Possible to add a 'sublime' windows action to right click?

#1

When I right click on a folder in Windows I get a windows dialog with multiple options for the folder. It would be really awesome if one of the options was the ability to open all the files in the folder within Sublime Text.

Example:
I also have textpad installed, and when I right click on a text file, I have the option of opening in Textpad. I do NOT have this option for sublime and I don’t know why. I want to be able to do that as sublime is so much better than textpad.

Is this currently possible to add this support?

*One of the coolest features of sublime that I use all the time is to open an entire folder of files so that I can search the entire folder for a string. That comes in very handy and it would be so much easier if I could activate that feature via right-click on a folder instead of having to first open sublime and then browse to the folder I want to open.

I’m sure hoping there might be an action addon somewhere that would accomplish this as it would make this so much faster to activate.

0 Likes

#2

Sublime Text doesn’t install these extensions itself, but Windows lets you do it. Something like this:
howtogeek.com/howto/windows- … all-files/

0 Likes

#3

thanks for the link. That works for file types, but not for folders.

Is there a similar trick that I can use so that when I right click on a folder, I can get the dialog to open the entire folder contents with sublime?
*similar to how it works when I open sublime then choose file->open folder

0 Likes

#4

Oh, it doesn’t work for folders? That’s weird.
I’m on OS X, so I can’t really play around and try to figure something out for Windows…

0 Likes

#5

I know this is an older post, but I figured I would offer up my findings just in case someone stumbles upon it. These instructions are for a computer running Windows 7. It may be similar for other versions of Windows as well.

From my quick research, to add SublimeText to the right-click menu when you right-click on a folder (as opposed to a file) you should follow the directions from the link that adzenith provided. However, rather than entering sublime_text.exe %1 you should enter sublime_text.exe %V. Or maybe in addition to entering sublime_text.exe %1 you should repeat the process but enter sublime_text.exe %V on your second time through. It is my understanding that sublime_text.exe %1 will allow you to open a file in SublimeText, whereas sublime_text.exe %V will allow you to open a folder in SublimeText. I could be wrong.

Another resource that I found recommended writing your own registry file that would add SublimeText to the right-click menu.

  1. Create a new text document on your desktop (it doesn’t actually matter where you create the document). I named my document add-ST3-to-right-click-menu.reg
    , but the name is not important as long as it ends in .reg.

  2. Open the file you just created in SublimeText and copy the code below and paste it into your document. Do not remove the empty lines - these are important. Also, a semicolon at the beginning of a line acts as a comment. Anything written on the same line that has a semicolon at the beginning of it will not be read by the computer when running the file.

  3. If necessary
    , edit the location of sublime-text.exe if it is in a different location than specified in the code below (“C:\Program Files\Sublime Text 3\sublime_text.exe”).

  4. After you are certain that all of the locations and file/folder names are correct, save the document and quit SublimeText.

  5. Browse to the location of your document and double-click it. This should add SublimeText to your right-click menu when you right-click on a folder.

  6. It may be necessary to log-off and log-in again or restart your computer in order for the registry to properly update.

***** WARNING* **** - This file updates your computer’s registry. If you do not know what you are doing and you do not feel comfortable running such a task, do NOT attempt this. I am not responsible for any damage that you may do to your computer if you do not know what you are doing.

[code]Windows Registry Editor Version 5.00

; This will make it appear when you right-click ON a folder
; The “Icon” line can be removed if you don’t want the icon to appear

[HKEY_CLASSES_ROOT\Directory\shell\sublime]
@=“Open Folder as &Sublime Project”
“Icon”="“C:\Program Files\Sublime Text 3\sublime_text.exe”,0"

[HKEY_CLASSES_ROOT\Directory\shell\sublime\command]
@="“C:\Program Files\Sublime Text 3\sublime_text.exe” “%1"”

; This will make it appear when you right-click INSIDE a folder
; The “Icon” line can be removed if you don’t want the icon to appear

[HKEY_CLASSES_ROOT\Directory\Background\shell\sublime]
@=“Open Folder as &Sublime Project”
“Icon”="“C:\Program Files\Sublime Text 3\sublime_text.exe”,0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\sublime\command]
@="“C:\Program Files\Sublime Text 3\sublime_text.exe” “%V”"[/code]
***** NOTE* **** - I have not been able to test my findings because I do not have permissions to edit the registry files that are necessary on my business computer to make this work.

I hope this helps someone. Feedback as to whether or not this works or how you edited the process or code to make it to work would be appreciated. Good luck!

0 Likes

How to get shell integration with Sublime Text Portable? [Windows]