Home Download Buy Blog Forum Support

Open with Sublime Text 2 for folders

Open with Sublime Text 2 for folders

Postby Thomaschaaf on Sat Jan 07, 2012 7:08 pm

Hey!

I am currently trying out sublime text and really like it.

I was wondering whether a feature could be added so that from the context menu I can open folders in sublime.

Greetings,
Thomas

P.S.: I hate the icon.
Thomaschaaf
 
Posts: 2
Joined: Sat Jan 07, 2012 7:05 pm

Re: Open with Sublime Text 2 for folders

Postby hibbelig on Sat Jan 07, 2012 7:52 pm

You can add the folder to the project.

There is also a plugin called Dired that shows you a buffer with a directory listing and then you can open subdirs, or expand them, or open files.

https://bitbucket.org/hibbelig/dired
hibbelig
 
Posts: 77
Joined: Wed Dec 21, 2011 11:24 pm

Re: Open with Sublime Text 2 for folders

Postby kapooostin on Sun Jan 08, 2012 8:48 am

Dired works fine, thank you for a cool idea.

It would be nice to have an option to reuse the same tab when navigating through folders.
And to have a global shortcut to switch to tab with Dired from any other tab.
kapooostin
 
Posts: 11
Joined: Mon Jan 04, 2010 11:09 pm

Re: Open with Sublime Text 2 for folders

Postby Thomaschaaf on Sun Jan 08, 2012 2:20 pm

I don't think you understood my request :(

Usually I open single files via the Windows Explorer and use this neat feature:
Image

When I try to open a folder though I don't get that option:
Image
Thomaschaaf
 
Posts: 2
Joined: Sat Jan 07, 2012 7:05 pm

Re: Open with Sublime Text 2 for folders

Postby ToddFiske on Sun Jan 08, 2012 5:00 pm

I was able to create a folder context menu entry (I copied a similar IrfanView entry), but Sublime Text doesn't seem to do anything differently when passed a folder name.

What would you expect to happen when you open a folder?
ToddFiske
 
Posts: 38
Joined: Wed Nov 04, 2009 10:43 pm

Re: Open with Sublime Text 2 for folders

Postby hibbelig on Sun Jan 08, 2012 8:56 pm

ToddFiske wrote:I was able to create a folder context menu entry (I copied a similar IrfanView entry), but Sublime Text doesn't seem to do anything differently when passed a folder name.

What would you expect to happen when you open a folder?


I would expect to see a directory listing. Or perhaps that the directory is added to the side bar and the directory selected in the side bar. If there is a ST window that is looking at a project that contains the folder you clicked on, then that window should be focused and directories should be expanded to show the directory you attempted to open.
hibbelig
 
Posts: 77
Joined: Wed Dec 21, 2011 11:24 pm

Re: Open with Sublime Text 2 for folders

Postby atomi on Mon Jan 09, 2012 8:49 am

You can try to run these commands from the command line (replace variable ${sublpathtoexe}).

Code: Select all
reg delete "HKLM\SOFTWARE\Classes\Directory\shell\subl" /f
reg add "HKLM\SOFTWARE\Classes\Directory\shell\subl" /t REG_SZ /ve /d "Open in Sublime Text"
# reg add "HKLM\SOFTWARE\Classes\Directory\shell\subl" /t REG_EXPAND_SZ /v "Icon" /d "${sublpathtoexe},0"
reg add "HKLM\SOFTWARE\Classes\Directory\shell\subl\command" /t REG_SZ /ve /d "${sublpathtoexe} --new-window \"%1\" "
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: Open with Sublime Text 2 for folders

Postby ToddFiske on Mon Jan 09, 2012 6:19 pm

@atomi: that's basically what I did, but with this registry script:

Code: Select all
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Open Folder with &Sublime Text 2]
@="Open Folder with &Sublime Text 2"

[HKEY_CLASSES_ROOT\Directory\shell\Open Folder with &Sublime Text 2\command]
@="\"C:\\SublimeText2\\sublime_text.exe\" \"%1\""


note: edit sublime path above

Problem is it doesn't do anything relative to the folder you start it from, even your variation of using --new-window. If you press Ctrl+O after it opens, it is not necessarily the folder that you right-clicked on. For me it always opens up to my user package folder.
ToddFiske
 
Posts: 38
Joined: Wed Nov 04, 2009 10:43 pm

Re: Open with Sublime Text 2 for folders

Postby kapooostin on Wed Jan 11, 2012 8:00 pm

Drag-n-drop directory to ST does not fit your needs?
kapooostin
 
Posts: 11
Joined: Mon Jan 04, 2010 11:09 pm

Re: Open with Sublime Text 2 for folders

Postby ToddFiske on Thu Jan 12, 2012 12:06 am

kapooostin wrote:Drag-n-drop directory to ST does not fit your needs?


Well what do you know! It works just fine, and the registry entry works the same way, but I didn't have the sidebar open so I didn't see it. File Open still comes up to another folder, but the sidebar is way easier. Thanks for pointing it out.
ToddFiske
 
Posts: 38
Joined: Wed Nov 04, 2009 10:43 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: estmatic and 35 guests