This post is a continuation of The Right Tools for the Job (part 1).

Over the years I have worked with many text editors. Some good and some bad. I started with PHP Expert Editor, the best editor I could imagine in 2007.

After moving from Windows to Ubuntu Linux I couldn’t find an editor that would suit me fully. I tried to make Vim my default editor but it wasn’t a successful attempt. The console looked too scary for everyday programming.

For some time I was using Gedit, but it can’t be considered as a full replacement for an IDE. It’s like Notepad for Linux. I also used NetBeans but it took ages to load, and it looked like a big monster to me (don’t hit me, NetBeans fans!).

I finally realized I needed a fast and lightweight tool and that tool was Sublime Text 3.

Sublime Text 3

Sublime Text 2 is pretty good, but if you haven’t yet, you should give Sublime Text 3 a try. While still in beta, it is much faster and has tons of great new features and improvements. In fact, I now use Sublime Text 3 for almost everything, from writing raw text files to programming or parsing logs.

These are a few of my favorite things.

One of the things I really love in Sublime are the powerful keyboard shortcuts. For example, Control-Tab — pressing this combination allows you to switch to the file you were in last.  No more dragging tabs around to get the order right, just click the tab you want to edit, and then Control-Tab to go back to the previous file, just like “back” in your browser.  Brilliant!

Another favorite is Control+Shift+R which allows you to navigate classes and methods. This is really helpful when working on a big project like FoxyCart.

As a developer at FoxyCart I write a lot of implementations for payment gateways. Usually the payment gateway’s documentation is only in HTML format or as a PDF document: not too friendly for writing code. Thankfully Sublime can help in this situation. This video shows how you can create a PHP array from the Stripe API page in just a couple minutes by combining regular expressions and Sublime’s powerful multi-line editing. Another good use case and video: creating a PHP class with setters and getters from an SQL structure.

Git-SVN

By the time I joined the FoxyCart team, I had already experienced the beauty of Git. For historical reasons we’ve always used Subversion repository for the main code. I just couldn’t work with Subversion itself, so I had to install git-svn. Now, new repositories we create are Git repositories but the main one is still SVN.

According to git-svn’s man page, it, “provides a bidirectional flow of changes between a Subversion and a Git repository.” You can use your Subversion repository just like it’s a Git one, which means you can:

  • Stash or make a commit of your local changes if you have something urgent to fix.
  • Experiment as much as you want and without showing your ugly temporary commits to anybody.
  • Re-base commits if you forget something.

Additionally you get “git blame” and “git log” that are faster-than-light versions of the same svn commands. When you want to send your commits to the SVN repository, you just do “git svn dcommit”. After that, your git commits become SVN revisions and no one’s the wiser!

So if you have to use Subversion, but like the power of decentralization that Git offers, I recommend bypassing Subversion’s limitations and just use Git-SVN.

The good news is that we’re finally going to move our main repository to Git. For me personally, this means more advanced branching, something that will really help our development.

SublimeGit

Finally, I would like to bring your attention to SublimeGit which is a plugin for Sublime Text 3. For just €10.00 they offer Git functionality that embeds directly into Sublime. This saves you time by not forcing you to leave the app.

Let’s say you want to run “git blame” on a current file: press Control+Shift+P to open the Sublime command palette and type “blame” (or even “bl”).  Simple.

Tips and Tricks

I asked our team for any tips or tricks they would like to share with our readers. Some you may already be familiar with, but hopefully you’ll learn something new!

Brett Florio
I’m big on Command+D, but I also like F12 to define whatever word I’m on, and Command+Shift+Space (useful in all languages) and Command+Shift+A (awesome for HTML). That and I use Command+Shift+L to split a selection into multiple lines pretty constantly, though more often for manipulating text files when copy/pasting/formatting.

Sami Fiaz
These are some of my most used keyboard shortcuts:

  • ctrl/command+shift+D                        // Duplicate a line.
  • ctrl/command+shift+Arrow keys         // move a line.
  • ctrl/command+/                                 // comment a line
  • ctrl/command+shift+v                        // For paste and indent
  • ctrl/command+m                               // for matching braces

Also, I have increased line spacing of my editor, will never go back.

Fred Alger
Control+- (minus) to jump to previous location. Works across files too. Really nice if you do a find and then want to get back to where you started.

Winston Hearn
Taking advantage of the Sublime Text Package interface is always helpful for me. Command/Control + Shift + P then type “install” and I can find any new language syntax or plugin that I need. Also, Sublime Text Projects are super helpful for collecting groups of files -since I work on freelance projects I’m switching between projects often and it is easy to pick up right where I left off with all open files by taking advantage of ST projects. They are managed under the Project menu.

What about you?

What tools does your team use? Any tips or tricks you would like to share? Please comment below.