The Sublime Text 2 code and text editor is speedy without sacrificing functionality, making it a popular choice for developers. In our ST2 advanced techniques series, we previously explored Sublime theming, projects, snippets, custom Sublime build systems, and more. We bring you the third installation of Sublime Text 2 advanced techniques, delving into how you can speed up your workflow with the use of plugins.
This post is part of a series on Sublime Text 2:
Faster Workflow Through Plugins
Right out of the box, Sublime Text 2 offers a lot of power and flexibility, but there are some areas where it falls short. In this tutorial, we will learn about the areas where ST2 could be better, and how to fill in the gaps with third-party plugins. The first thing that you will need to already have configured for this tutorial is package control. If you don’t have that set up yet, check out our post on Five handy Sublime Text 2 tips first and then come on back!
At this point, you should already have package control installed. The first area that ST2 falls short is in the sidebar options. If you have ever right-clicked on a file or folder in the sidebar, then you know exactly what I’m talking about. The first plugin we will discuss fixes that for us, and adds a plethora of other awesome features that makes speeding up development a breeze.
SideBarEnhancesments, as the name would suggest, adds all the common functionality of right-clicking on a file, plus much more. First things first, let’s get it installed. Press Ctrl + Shift + P to bring up the task menu and then start to type install. If you have package control installed, then you should see an option to install a package. Make sure it is highlighted and press Enter.
Now we can harness the power of fuzzy searching. Start typing SideBarEnhancements into the task menu and once that plugin is highlighted, press Enter again.
If everything is configured correctly you should now have a super sidebar menu. Test it out by right-clicking on a sidebar file or folder. You should now have the option to add files and folders, move files and folders, and much more. Play around with the settings and make sure to look at the project option at the bottom. The edit project preview URLs come in handy when working with projects being served with XAMPP, or whatever local server system you use.
The next plugin that saves me tons of time is SublimeLinter. (To install this plugin, simply follow the steps you used to install SideBarEnhancements.) Once this plugin is configured, it can save you a ton of time by showing you errors in your code in real-time. I use it for CSS, JS, and PHP. This saves me a lot of time because I don’t have to try to preview my work only to find that it’s not working because I forgot a semi-colon or a closing bracket somewhere. The configuration of this plugin is a little bit out of scope for this tutorial but head over to GitHub and from there, you can check out all the configuration options for this plugin.
We won’t go into details anymore on installing the following plugins, but by now, you likely see how easy it is to do this with package control. =]
This is another great plugin that saves me a lot of time by really beefing up the auto-complete functionality of ST2. It is smart enough to remember variables from your current file, classes from a project, and much more. Pretty much anything that is available in the current file/project shows up in the auto-complete. Don’t let that previous statement discourage you, this plugin does a great job of making sure the right options are at the top of the list. Rarely have I had to press anything other than tab when the auto-complete kicks in.
This is another great package that saves me a lot of time. First let me say that this is only a useful plugin if you are not yet using dependency managers for your project. If you don’t know what I’m talking about then you should Google it immediately. If you do know what I’m talking about, then you will see why this plugin won’t be of much use to you.
This plugin will actually fetch your project dependencies for you. What that means is that when you start a new project there are some things that you most likely need each time. An example would be jQuery. I use it in almost every project and in the olden days (before this plugin!) I used to go to the jQuery website and download the latest version and then copy it into the vendor folder in the js section of my project. Rinse and repeat for each project. What this plugin does is download that file/set of files for you and store them in a folder you designate.
Let’s walk though it together. First install the plugin and then we will continue.
Once you have the plugin installed bring up the task menu (Ctrl+Shift+P) and start typing “fetch manage.” Once that option is highlighted, press Enter.
You should see a config file that resembles this, except for all the paths I have already defined.
Now replace the contents of the file with the following code:
Save the file and you now have the option to fetch any one of those packages/files. So easy! (Be sure to add any packages you need. This is just to get you started.)
Now lets put this to use. Open a project or create a new one for testing this. Once you have it open in Sublime Text, bring up the task menu and type fetch, pick either file or package and select one of the available options.
At the bottom of the screen, you should see an input field asking you the location you would like to download to.
Just specify the path from the root folder of your project and you’re done. That’s a lot faster, if you ask me!
I hope these plugins can be as useful to you as they are to me. I also hope you can see how much time they can save if used regularly! Now go forth and code with class and efficiency!
Similar posts on Sublime Text 2:
- Tutorials, tips, and theming: Best of Sublime Text 2 series
- Five handy Sublime Text 2 tips
- Sublime Text 2 advanced techniques [part 1]
- Sublime Text 2 advanced techniques [part 2]: Custom build systems
- Sublime Text 2 advanced techniques [part 3]: Faster workflows through plugins (current)
- Theming Sublime Text 2
Do you have any Sublime Text 2 comments or tips? Share with us in comments or tweet us @Pixafy!