Hiding files and directories in a Sublime Text project

I spend a lot of my time developing WordPress sites in Sublime Text 2. WordPress comes with a bunch of files and directories that I rarely need to touch (wp-includes, wp-admin, wp-cron.php, etc).

There is an easy way to hide these files from the Sublime Text sidebar, as illustrated below (left: default, right: hidden files).

My Alfred blog post workflow

To hide files from the sidebar, you’ll need to:

  • Save the current open directory as project (Project > Save Project As)
  • Open the .sublime-project file and copy the path
  • Paste in the following code and paste in the path copied above
{
 "folders": [
	{
	 "folder_exclude_patterns": [
		"wp-includes",
		"wp-admin",
		"wp-content/plugins",
		"wp-content/uploads"
	 ],
	 "path": "/your/project/path/here",
	 "file_exclude_patterns": [
		"wp-app.php",
		"wp-blog-header.php",
		"wp-activate.php",
		"wp-comments-post.php",
		"wp-cron.php",
		"wp-links-opml.php",
		"wp-load.php",
		"wp-login.php",
		"wp-mail.php",
		"wp-pass.php",
		"wp-register.php",
		"wp-settings.php",
		"wp-signup.php",
		"wp-trackback.php",
		"xmlrpc.php"
	 ]
	}
 ]
}

Of course, you can add and remove directories or files as you require and it doesn’t have to apply to WordPress: you can use this method to hide any directories or files you want.

I’ve turned this into a basic TextExpander snippet. Simply copy the path to the clipboard, then type “;sublwp” and you’re done. You can download the snippet here.

Related articles

Where to go next

1. If you'd like to discuss working together, I'd love to hear from you. Even if you don't have a specific project in mind, but would like to start the relationship for when you do, go introduce yourself.

2. If you enjoyed this article, why not share it on Twitter, Facebook or LinkedIn?

3. If you want to get my writing delivered to your inbox, subscribe to my newsletter. I only send out one email per month and you're free to unsubscribe at any time.

4. If you're on the socials, you can follow me on Twitter @marcjenkins or send a request on LinkedIn.