Package Control

Package Control

##What is this Package Control everyone’s going on about? Packages, are custom plugins, snippets, and macros. Package Control is the Sublime Text package manager. It includes 2,500 packages that do everything from expand HTML tags to highlight hexadecimal colors to autocomplete file names. Additionally, users can add BitBucket or GitHub repositories themselves. The stats on package control are incredibly impressive.

Today this server delivers around 5TB of compressed json data a month and has seen over 2.7 million unique clients connect. Full stats here.

##Installing Package Control Detailed instructions for installing Package Control can be found on the Package Control website. However, the gist is this (below).

###Simple Package Control Installation Go to the Sublime Text console via ctrl+ or View > Show Console. A window will open at the bottom of your current Sublime Text window. From there type or copy and paste:

####SUBLIME TEXT 3 import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

####SUBLIME TEXT 2 import urllib2,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')

###What does the installation do? The Package Control Installation will create the Packages folder for you. This is the folder where all of your packages will live. This folder is inside your Sublime Text directory in your Applications folder. The installation also downloads the Package Control.sublime-package into your new folder.

###How do I get to Package Control? cmd+shift+p will do it for you in OS X or ctrl+shift+p in Linux/Windows. This opens the Command Palette which offers you a text field where you can control Package Control.

####How do I install packages?

  • To install packages type install package and a window will pop up showing you packages available for install. Beware: This is an exhaustively comprehensive list. You’re better off using the search field to find what you want.

####How do I add additional repositories?

  • To add a package hosted on GitHub, enter the URL in the form https://github.com/username/repo. Don’t include .git! BitBucket repositories should use the format https://bitbucket.org/username/ repository.

####How do I remove packages?

  • To remove a package type remove package. This will delete the package folder and the package name from the installed_packages list in Packages/User/Package Control.sublime-settings.

Fun Fact You can copy the installed_packages list into the Packages/User/ folder on another computer and Package Control will automatically install the packages for you.

###The best packages for Sublime Text

###A few packages I recommend

  • Auto File Name are you tired of images not loading or programs unable to locate files? Auto File Name will offer a dropdown menu of file names as you type. It even lets you drill down through several directories like images/team/accounting/image.jpg
  • Bracket Highlighter takes the guesswork out of which bracket your actually closing. This is great when you have a million <div> tags in HTML or 3 nested iterators in a ruby hash. The package will display the opening and closing bracket on the left hand side for any piece of code the cursor is on. brackethighlighter
  • Emmet is one of the most popular packages for Sublime Text with over 1.3 million downloads. It allows you to write HTML in shorthand and expand it using the tab key. For example ul>li*3 becomes

<ul> <li></li> <li></li> <li></li> </ul>

  • Color Highlighter is a great plugin for anyone who hasn’t memorized the 16,777,216 hexadecimal colors, so most of us. It highlights any color in your code whether it’s hexadecimal, RGB, or just written out like ‘blue’. It also allows you to select colors using a color picker window.
comments powered by Disqus