Sublime Text: Making Fetch Happen

Regina George Fetch isnt going to happen

Wrong, Regina George! Fetch is SO going to happen. Fetch is amazing!

NetTuts+ Fetch is a package for Sublime Text 2/3 that accesses a remote resource and downloads it into a directory or file of your choosing. Sounds simple, right? That’s because it is!

If you don’t already have Package Control installed on your copy of Sublime Text you can grab it here.

Once you’ve installed Package Control press cmd+shift+p (OS X) or ctrl+shift+p (Windows, Linux) to bring up the command palette and type “Package Install”.
You can now type “Nettuts+ Fetch”, select, and press enter. You can check out the installation progress in the lower, left-hand corner of your Sublime Text window.

Adding resources to Fetch

Now that you have Fetch installed you can add your most used resources. Bring up the command palette, press cmd+shift+p (OS X) or ctrl+shift+p (Windows, Linux), and type “Fetch: Manage” (In ST2 it may say “Fetch: Manage remote files”).

Fetch Command Palette

Like everything in Sublime Text your remote files are stored in a JSON array.

Fetch settings json array

There are two objects, “files” and “packages”.

Files are for single files, such as the jQuery min.js or normalize.css. Packages are for .zip files containing multiple folders/files such as the HTML5 boilerplate. As you can see, I’ve also added Foundation CSS framework and two different places I can pull WordPress from.

Using Fetch: Files

When you Fetch a file the contents of that file will be inserted into the document you currently have open.

Create a blank file

Fetch create a blank file

Bring up the command palette, press cmd+shift+p (OS X) or ctrl+shift+p (Windows, Linux), and type “Fetch: File” then type the name of the file you want to Fetch

Fetch select file

Voila! The content of the file you have Fetched is now in your file!

Fetch file display

Using Fetch: Packages

When you Fetch a package you’ll be prompted to indicate which directory the package should be unzipped into.

Create a new project

Fetch package create new project

Bring up the command palette, press cmd+shift+p (OS X) or ctrl+shift+p (Windows, Linux), and type “Fetch: Package” then type the name of the package you want to Fetch

Fetch package select

You will be prompted, in the lower left-hand corner of your Sublime Text window, to say where you’d like to extract the package files

Fetch package select location

Voila! The contents of the package you have Fetched have been downloaded and unzipped and dropped into the directory you indicated!

Fetch package display results

That’s so Fetch!

That is so Fetch!

That’s right, Gretchen Wieners! Fetch is SO fetch! I’ve timed myself and I can get WordPress plus Foundation plus my normalize.css downloaded and ready to go in less than a minute. Less than two minutes if I don’t have the handy AdvancedNewFile package installed that allows me to create files and folders from the Sublime Text command line.

So, what are you waiting for? Install NetTuts+ Fetch and let’s get coding!

Were going coding