Sublime Text 2 - Open folders

2019-03-14 07:12发布

问题:

Is it possible to open multiple folders in the same window using Sublime Text 2?

Selecting File->Open Folder always opens the folder in a new window.

Sublime Text is an excellent editor, but this issue is a bit annoying.

回答1:

You can use the Add folder to Project... item on the Project menu to open a folder in the current Sublime Text 2 window.

With Sublime Text 2, a project is always open, even if it is anonymous and unsaved.



回答2:

In Sublime text 3, you can just drag and drop folders, it will open multiple folders. However i have not tried it in Sublime text 2.

Update:

Drag and drop works in Sublime text 2 as well.



回答3:

From what I can tell, this behavior is built in. In Packages/Default/Main.sublime-menu, the listing for Open Folder… is

{ "command": "prompt_open_folder", "caption": "Open Folder…", "platform": "!OSX" }

Unfortunately, after searching all through the installation, there's no macro or .py file with the prompt_open_folder command, so it must be a hard-coded part of the binary, which makes sense, because it's a system call to the operating system/window manager to open a file picker dialog.

It should be relatively straightforward to write a plugin to select a folder for inclusion in the current window, but unfortunately I'm not quite able to at the moment.