Rapid Development with Sublime Text

If you scan the posts in my blog, you’ll quickly see they all have one thing in common: Speed. I like to learn things that help me move quickly for two reasons: I get to ship more code (service more Clients) and I get to learn more things. Win win.

One thing I spend every few months or so going through is my Sublime Text workflow.

This is an old feature, but man oh man did it help save a lot of time this week. If you’re like me, you’re probably jumping through a lot of files trying to find Class definitons, variables, and the like.

Goto -> Goto Symbol in Project can help with that, especially with namedspaced top level classes.

At the same time, this is all great, but by default it will search everything, which is bad. If you’re using CoffeeScript, you probably don’t want to hit all of your .js files, and the same goes for CSS preprocessors.

Sublime Project Settings for the win!

Hit the Project menu and go to Save Project As.... Then, hit Edit Project in the same menu, and add something like this:

my_project.sublime-project
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  "folders": [{
    "file_exclude_patterns": [
      ".gitignore"
      "apps/**/*.js",
      "dist/js/**/*.js",
      "dist/js/*.js",
      "dist/stylesheets/*.css"
    ],
    "folder_exclude_patterns": [
      "assets/components",
      "gulp",
      "docs",
      "dist/build"
    ],
    "follow_symlinks": true,
    "path": "src"
  }]
}

Boom. All those nasty artifact files are completely ignored from the listing. You can exclude entire directories, just files, or as you can see hear use patterns to define files to ignore.

Overall performance, file indexing, and searching across your codebase is also vastly improved with this. I haven’t even taken it to the level I want to yet (there are a few more patterns I’d like to add), but this is a huge step in the right direction.

The cool thing here is, as you write rules and save this file, it’ll automatically refresh your folder list. So, you can temporarily and quickly add a folder pattern back into the view and not worry about reopening the project or relaunching Sublime.

I’m way behind the ball with this feature, I know, but hey, give me some credit that I’ve made it this long without finding a building to jump off of. Good day!