It should be possible to organize sidebar items into custom categories.

Miloš Levačić 6 years ago • updated 4 years ago 4
I use Sublime Text 2 for web development. A lot of the times I will have 20+ files open in the sidebar (PHP models, views, controllers, configuration files, CSS files, javascript, etc.), and I would really appreciate an option to be able to sort them into custom categories. Ie. like there is the default "OPEN FILES" category, I would like to be able to add my own (and name them however I like), and drag files between them. Even better, a tree-like structure would be even awesomer - actually, it's something like a folder structure for a project, but I'd like to be able to customize it independently from the actual file system, since my file organization is usually a bit different due to the underlying framework in use, and I'd prefer seeing only the currently open files sorted by category, than the complete file/folder tree that shows up in the FOLDERS category, when you add a folder to the project.
ya i agree. folders within projects. basic but necessary

So this thread is a bit old now, but I recently came up with a creative hack to sort of get around this problem and thought I'd share. It's not beautiful, but it works...

Create a new file, and type a bunch of hyphens on the first line. You don't need to save the file, but Sublime shows the contents of the first line in the sidebar. This effectively creates a separator that you can use to visually group your open files. You can of course use any characters you like, not just hyphens. Even better, you can create named separators such as

=== CONTROLLERS =============

It means you can no longer save all open files in a single shot, but if you need the visual groupings badly enough it's a reasonable compromise.

Again, not terribly elegant, but hope it helps somebody in the absence of a proper solution at the moment.

@Dan Dailey

Hi there, I've forgotten all about this thread! Well, in the meantime, I've actually found a better solution, and it involves editing the .sublime-project file. I was using CodeIgniter at the time of writing of this post (and still do for some projects), and I've found the following snippet helps me organize folders a bit better:

			"path": "app/controllers",
			"name": "controllers"
			"path": "app/models",
			"name": "models"
			"path": "app/views",
			"name": "views"
			"path": "public/css/src",
			"name": "css"
			"path": "public/js/admin/src",
			"name": "js/admin"
			"path": "public/js/init/src",
			"name": "js/init"
			"path": "/",
			"folder_exclude_patterns": [ "app/controllers", "app/models", "app/views", "public/css/src", "public/js/admin/src", "public/js/init/src" ],
			"name": "/"

That's just an example that matches my own folder structure and workflow, and there's only one little problem with it - when using "Find in Files (CTRL+SHIFT+F)", some results turn up twice, e.g. once in the "controllers" path, and once in the "/" path (which I need, so as to be able to access all other stuff that's not covered by the first few defined paths). The "path" definitions are relative to the .sublime-project file - by default, there is only one path set, and it's absolute, but it's completely okay to change it. I always keep my .sublime-project in the root of my project folder, so that works great for me.

The structure defined in the .sublime-project file appears in the "FOLDERS" (the lower) section of the sidebar, rather than "OPEN FILES" (the top one), which I've gotten used to. In the meantime, I've gotten so used to using "CTRL+P" anyway, that I don't really use the sidebar that much to find stuff in my project anymore, but it can be useful to get a glance of where stuff is when you need it.

Hope this helps someone, cheers!

So, sorry for bumping such an old topic, but I just remembered this exists, and a few months ago, I randomly thought to try using path": "." instead of "path": "/" to solve my problem with duplicate search results, and what do you know - I succeeded!

Of course, this only works because in our shop, we always keep the .sublime-project file in the project root, and I guess it isn't applicable to people who manage their projects differently, but this way, all of our devs can just clone the repo, and they already have the same folder categorization as others.

Basically, this post was an attempt to avoid http://xkcd.com/979/ in case anyone ever thinks they need to do the same thing!

Good luck,