SHARE:
Uncategorized

Packages for Sublime

Flatiron School / 28 October 2013

The following is a guest post by Patrick Janson and originally appeared on his blog. Patrick is currently in the Ruby-003 class at The Flatiron School.

Yesterday, at the Flatiron School, Anders Ramsay, and I were working on some code and stuff in Sublime Text.

I was starting a new .erb file when he told me to stop coding and said that I couldn’t continue to use Sublime anymore until I had installed Package Control. Sublime has package extensions? Mind blown.

How come no one invited me to the sublime package party?

Package Control

So in case anyone else didn’t get invited to the awesome sublime package party. Here is a quick run down. I installed like 50,000 of them this weekend.

Now I don’t even have to code. I just stare at Sublime and use the Yoda package to code for me.

For sers though, packages in Sublime are like Gems for Ruby. They give you super powers…or at least auto-complete and some sweet templating options.

Installation

Package Control is package manager that helps you extend and modify the Sublime editor. Lets get it installed, add a new package, and remove a package to get familiar with Package Control for Sublime.

  1. Install Package Control – Get Package Control Here

  2. Once here just copy and paste the correct Python code depending on which version of Sublime you have. Below is the code for Sublime Text 2.

Open Sublime and pop open the Sublime console by pressing crl + `.

Paste the code snippet into the console, press return, and restart your editor.

Channels and Package Installation.

Sublime Packages generally are found in the “Default Channel”. This is channel is the open source forum where developers add their packages and they can be easily searched and downloaded.

The option to create custom channels exists but we won’t touch on that here.

Package Control is evoked through the command palate.

  1. Open the Command Palate: cmd + shift + p will pop open the command palate.

  2. Type Install into the text area and you will see that package install option will be available.

Package Install

  1. Select the option Package Control: Install Package

  2. You will now be able to search by Package name. Even if you don’t know if a package exists that you are looking for. Just type in a few terms and see what comes up.

  3. We are going to install a package called SideBarEnhnacements. This extension will give us some extra options when we are working on applications that have a robust directory structure.

A concrete example would be that we wouldn’t need to switch to the terminal to type out mkdirwhen we need a new folder.

  1. Restart your editor after you hit return on SideBarEnhnacements.

  2. Open any application you are working on and ctrl click on the side bar. You will see the enhanced options that the SideBarEnhnacementspackage we just installed now gave us.

Package Folder

Remove a package

  1. If for any reason you want to remove a package. Just open the Command Palate again with cmd + shift + p but now type remove and then select Package Control: Remove Package This will allow you to select for your package library what you would like to remove.

Editing Packages

Many packages such as Gist require some sort of configuration. If so, you can browse your packages by selecting browse packages from the Sublime Text preferences dropdown.

There are ton of usefull packages out there and a solid community of people that are interested in pushing the Sublime development tool forward.

Check out the links below for a few that I am currently using and also a search on the Package Control site for all Ruby related packages.

My Packages

Ruby Packages Search Ruby Package Search.

SideBarEnhancements The one we installed.

HTML5 HTML5 Snippit library.

Gist Create github gists from highlighted texts.

GitGutter See the git status of each line of code.

Four Lessons I Learned While Porting a Gem Into a Sinatra App Previous Post Globular Next Post