I’ve recently switched from using Netbeans as my PHP dev tool of choice to Sublime Text 2. Features-wise, I think Netbeans is great. During the years I used it, I never felt that there was a feature I needed that was missing at the time. But, like all the current crop of Java-based desktop IDEs, it’s so damn ugly [1] and slow [2] that I’ve had enough. I program because it’s something that I love doing, and anything that gets in the way of that … I’ve no time for any more. So when a work colleague introduced me to Sublime Text 2, I was in the mood to give it a go, and 3 months on, I haven’t opened Netbeans once.

I’ll be the first to say that Sublime Text 2 isn’t for everyone.

  • It’s a beta product, which means there are some rough edges (mostly in the plugin API I feel), but it’s more than stable enough for production use. It has crashed a couple of times, which might put some people off, but I don’t recall losing any work as a result. File management in the project pane still needs work. The regular dev builds occasionally break things.
  • It isn’t a full-blown IDE; it’s more like the spiritual successor to TextMate, an editor that I never personally cared for. In particular, it doesn’t support interactive debuggers, which means no Xdebug support, and there’s currently no obvious way for a plugin to add that functionality in [3].
  • Auto-completion isn’t anything like what you’re used to. The built-in auto-completion is based on a mix of static knowledge of languages and fuzzy matching against what you’ve recently typed. There’s no obvious intelligence about the code you’re working on, nor the parameters for any method or function. These are two things that many people will deeply miss. [4]
  • It isn’t free, but you can evaluate it for free with no time limit. If you decide to buy, it’s substantially cheaper than both PhpStorm and Zend Studio, and there’s no annual subscription element to the licensing. You’re buying a license to support and encourage an independent developer, and to show your appreciation for a very nice piece of software.
  • It’s a closed-source product. You can’t fix it yourself if it breaks, and no-one can pick up the reigns if it gets abandoned. There seems to be just one guy behind it, and if anything happened to him, that’d probably be the end of the product. That said, most of the alternatives are also closed-source too.

Given all of that, why have I switched?

  1. Sublime Text 2 is very very fast. Sublime Text 2 itself opens instantly. Files open instantly (provided they’re not 100 megabyte test data files). In fact, everything happens instantly – even inside a virtual machine running on a 3 year old laptop. There are no pauses for anything to be indexed, and I’ve never seen CPU usage spike – important for us untethered users and our suffering laptop batteries [5]. And if a plugin slows things down at all, Sublime Text 2 tells you which one is the culprit so that you can go and disable it. I’d compare the importance of the speed difference to switching from a hard disk to an SSD. You don’t realise how much you’re waiting for your slow Java-based IDE until you use something that’s properly fast.
  2. It renders fonts properly – Droid Sans Mono and Ubuntu Mono in particular both look gorgeous – and even after a long day of use, my eyes don’t feel like they’ve been scratched on the inside by sharpened kitty claws all day long [6]. True story: one of my colleagues came over to ask what I was using, because he thought it looked so nice from a distance. When was the last time anyone ever thought that about a desktop Java app?
  3. All of the searching is based on an extremely powerful fuzzy matching approach. Netbeans supports regexes, which can be very handy, but most of the time when I’m looking for something, a regex is overkill but a simple string search isn’t powerful enough. If I’ve got both a class called ‘IpcProcess’ and ‘IpcProcessID’, in Sublime Text 2 I can find the ‘IpcProcessID’ class by searching for ‘ipi’; I just have to type the shortest set of characters that uniquely matches what I’m looking for. It’s much quicker than writing (or running) a regex, and soon becomes second nature.
  4. There’s a “goto anything” search panel which is lightning quick. Combined with the fuzzy matching approach, I find this a godsend for working on multiple large code bases, where there may be different classes with the same base filename, or duplicate installs of a class in vendor folders, or where I’ve got both trunk and branches checked out for the same project. It’s a killer feature, and one that has changed my workflow for the better, especially combined with my next reason. The panel’s also like using Google Instant – you get results as you type, giving you the instant feedback you need to refine your fuzzy search. (There is also a “goto symbol” search panel, and a “command palette” which allows you to search through the available editor commands to execute).
  5. Everything can be done from the keyboard. Everything can be done from the mouse too, but I found that doing everything from the keyboard is both faster and doesn’t break the flow of what I’m working on. This is something I didn’t appreciate until after I’d switched, but it’s a fantastic help to me when I’ve got another developer sat next to me and we’re looking at (or for) something together. Together with the fuzzy matching, it’s like doing software archaeology with a JCB digger instead of a trowel.
  6. It does a great job of auto-detecting whether a file uses spaces or tabs for indentation, and how big the tab stop is. There are days when it seems like no two files I open are consistent in how the code is indented, and it’s rare for anyone to have tagged on a modeline to give any hints. With Netbeans, which has a rigid config-based approach to indentation, I end up playing code-formatting table tennis with the original author of the file, as we always seem to have different indentation settings. Sublime Text 2 works out what the existing indentation approach is, and just auto-configures itself to match. It’s a great time saver [7].
  7. It strips trailing spaces from the ends of lines when I save my files. This has been broken in Netbeans for years! It’s a small thing, I know, but it really annoys the crap out of me that Netbeans doesn’t get this right. As a bonus, in Sublime Text 2 trailing spaces actually get their own setting in color schemes, so you can see exactly where they are. In Netbeans, they’re bloody invisible :(
  8. There’s a healthy ecosystem of plugins for it – over 200 plugins and counting – thanks to Will Bond’s Package Control package manager. Will is doing a great job of making sure that each plugin is tightly focused on sorting one problem only, to keep Sublime Text 2 as flexible and adaptable as possible – something to keep in mind if you start writing plugins yourself.
  9. Creating new plugins is very easy. It took me just one evening to add and release the initial PHPUnit plugin, and that included the time it took to learn both Python and the plugin API from scratch. To make an update to your plugin, simply push your changes to your master branch on GitHub. It’s as close to frictionless as you can get.
  10. I can own the tool, and set it up to suit my approach to programming. Because extending the editor is so effortless, I can automate anything that I want, to suit exactly how I want it done. I can create snippets, intelligent macros, and full-blown plugins to suit, and I can make them as and when some new need occurs – even one-off tasks. In this, it reminds me most of JED, which was my text editor of choice back in the 90′s for exactly the same reason. It’s the same reason folks love Vim. (Btw, Sublime Text 2 has a Vim mode. I haven’t tried it, so I can’t vouch for whether it’s good enough to tempt Vim users over or not).

Like Netbeans, Sublime Text 2 works on OS X, Linux and Windows [8], so I can use it everywhere I used to use Netbeans. I reckon it occupies a sweet spot that makes it very well suited to scripting languages and C/C++ development, albeit minus support for interactive debuggers.

At work, some of us have taken to it, and some of us haven’t. I’m happy to recommend it to anyone who’s looking for a change. You can take advantage of the open-ended free evaluation period, and see if it suits you or not. It’s working for me so far, and I probably spend more time using it than any other app on any of my computers.

If you do like Sublime Text 2, I’d love for you to leave a comment below with your own reasons why.

Footnotes

  1. Dear Java, the 1990′s called and asked for their crappy non-aliased font renderer back. I think Windows 3.11 is missing it terribly.
  2. There was a similar parallel around 20 years. At the time, Emacs was by far the most fully-featured editor, but everyone I know chose vi because of how slow and bloaty Emacs was at the time. It was so bad, we used to say that Emacs stood for “Eight megs and constantly swapping” (this was back in the days of 640K of RAM).
  3. The lack of debugger support is, for me, the one feature that I miss every single day.
  4. There is a plugin that tries to bring Komodo’s auto-completion to Sublime Text 2, but it stopped working for me before Christmas sadly.
  5. It’s like when you switch from Firefox to Chrome for the first time … your laptop just gives a sigh of relief, and you don’t have to worry quite so much about how far away you are from the next convenient wall socket to recharge from. I can easily imagine running this on a netbook, or a laptop with very aggressive CPU throttling in place – both places where a Java-based IDE would struggle.
  6. I’m highly visual, and find it really tiring to spend 10-12 hours a day in front of poorly-rendered fonts.
  7. Now, if only everyone just did the right thing in the first place and used spaces instead of tab characters, we wouldn’t need functionality like this … :)
  8. The keybindings are different from one platform to another, and because Python isn’t a platform-agnostic language, some plugins may not work properly on Windows at first. But most plugin authors are happy to accept pull requests with portability fixes.

26 Comments

  1. Akhmad Fathonih says:
    February 20th, 2012 at 7:27 am

    Been using Sublime 2 in tandem with Netbeans. I agree, Sublime 2 is FAST and straight forward for editing. but somehow I keep coming back to Netbeans. I used to use Kate for coding. It’s pretty much similar to Sublime 2 (plus KDE’s KIO goodies, minus great font).

    Code completion on functions and class prop probably the things I can’t miss at the moment. For a quick session, testing some chunk of code, or project with really few files, I often use Sublime 2.

  2. Markus Fischbacher says:
    February 20th, 2012 at 8:06 am

    I absolutely agree. There are some downsides with st2 but for most of them you could install a plugin.
    The documentation could use some work too but as you said it is beta.

  3. Bauffman says:
    February 20th, 2012 at 8:25 am

    I used to be a Zend Studio user, but recently I’m switching to VIM. The learning curve is pretty steep and I’m not yet at the speed level I was when I work with Zend. However I do notice that I’m improving each day and start missing VIM functionality within Zend Studio. To me, Zend Studio, and most of the java IDE’s are too bloated, slow and not very user friendly.

    MacVIM is also very nice if you really cant do it without the mouse :)

  4. Nat McHugh says:
    February 20th, 2012 at 10:04 am

    I too have recently made the switch from netbeans to Sublime Text 2 and I’m very happy with my decision.

    For me the big thing is the speed and also the speed is predictable. With both netbeans and eclipse I have often started editing a file only to find that the IDE is not echoing what I’m typing but doing something else such as searching for a list of autocomplete functions. The speed of searching is also a big wow in Sublime. It seems to do it so quickly and without background indexing that I can detect. Also not being an IDE means that if you want to create a new file it is a simple key stroke and not a wizard with 4 steps asking what kind of file you want and where you want to create before you even start typing.

    Things I miss are: The navigator pane which in netbeans gives a quick ordered list of all functions in a class (probably fixable with a plugin). I also feel that the tree view is slightly less easy to navigate or maybe just less memorable.

  5. Maxime says:
    February 20th, 2012 at 10:16 am

    So you are switching from NetBean for something buggy, not free and that is not offering what you are looking for ??
    I didn’t really get it…
    I’ve used Neteans, Zend Studio and Eclipse, but nothing is better than PHPStorm !
    It’s just the best. Never crashed. Auto-complete is working like a charm. Not that heavy for a JAVA based application.

  6. Pierre says:
    February 20th, 2012 at 10:57 am

    PHPStorm for the win. Cross platform, debugger (cli or web, local or remote), static analyzer, etc. etc.

  7. Harald Ponce de Leon says:
    February 20th, 2012 at 11:16 am

    The SublimeLinter plugin is great for detecting syntax errors:

    https://github.com/Kronuz/SublimeLinter

  8. Michał Ty says:
    February 20th, 2012 at 12:01 pm

    I can only speak about the PHP version of Netbeans, but it’s not slow if you get the right hardware. Buying a very fast computer should be the obvious thing to do for a developer. It’s not that expensive either — much, much cheaper than, say, a used car.

    And the fonts look great, I’m using Consolas and it looks exactly the same as everywhere else on my system. I think you’re doing something wrong :)

    I do, however, envy the fuzzy searching.

  9. Nike Shoes says:
    February 20th, 2012 at 12:38 pm

    1.Dear Java, the 1990′s called and asked for their crappy non-aliased font renderer back. I think Windows 3.11 is missing it terribly.

  10. Timothy Warren says:
    February 20th, 2012 at 2:02 pm

    I miss the object viewer, or whatever that’s called in Netbeans, but that’s about it. If there was a plugin for that I’d be all set.

  11. JonoB says:
    February 20th, 2012 at 3:48 pm

    No debugging capability unfortunately makes it close to useless for me.

  12. Stuart Herbert says:
    February 20th, 2012 at 3:48 pm

    @pierre: it’s very powerful, but still renders fonts like it’s 1994.

  13. Stuart Herbert says:
    February 20th, 2012 at 3:49 pm

    @Harald: yes, I use that one myself, but I know several people who have found it slow on their systems.

  14. Stuart Herbert says:
    February 20th, 2012 at 3:51 pm

    @Michal: I didn’t think that Netbeans was slow until I ditched it for ST2. Even on a decent Core-i7 w/ 8GB of RAM and a decent SSD, Netbeans is left for dead by ST2′s speed.

  15. Stuart Herbert says:
    February 20th, 2012 at 3:52 pm

    @Timothy: you can get close. You can hit CTRL+R to browse the symbols in the current tab, and (if you install the Goto Symbol plugin), you can hit CTRL+SHIFT+R to browse all symbols in all open tabs. I find this works well for me, as there’s more space on-screen for code :)

  16. Stuart Herbert says:
    February 20th, 2012 at 3:53 pm

    @JonoB: yeah, that’s one thing that does need adding :(

  17. Stuart Herbert says:
    February 20th, 2012 at 3:54 pm

    @Maxime: no, I switched from Netbeans to something that’s incredibly quick (which PHPStorm isn’t), and which renders fonts properly (again, which PHPStorm doesn’t), and very extensible. That is what I was looking for :)

  18. JiN says:
    February 20th, 2012 at 4:59 pm

    Can’t give up all the features that NetBeans provides. The one I use for every new project is the Code Generator for PHP Classes. Also I have heavily customized the keys as well.

  19. Liviu says:
    February 21st, 2012 at 7:16 am

    ST2 is great but I still open netbeans for that diff feature.

  20. Sky says:
    February 24th, 2012 at 9:33 am

    Hello

    I tried this … for 2 days, cant stand it anymore :)
    Im going back to netbeans.

    I had bug after bug with Windows 7…

    I must say that all the Features Netbeans has is going to keep me for a long time still.

    And its free and is free. :-)

  21. La veille du week-end (vingt-cinquième) | LoïcG says:
    February 24th, 2012 at 12:11 pm

    [...] 10 (bonnes?) raisons de passer de Netbeans à SublimeText2: #fdw #ide #netbeans #sublimetext2 : via @LaFermeDuWeb [...]

  22. mandev says:
    February 29th, 2012 at 10:45 pm

    I tried ST2. It crashed 3 times in a week. Back to netbeans. Will try again next year. END.

  23. Review: 2 PHP tools rise above the rest | freecsswebsitetemplates.com says:
    March 21st, 2012 at 8:22 pm

    [...] Herbert, a PHP developer, switched to Sublime Text, a some-more elementary content editor, and wrote about a change, extolling a simplicity. In essence, he didn’t need all of a additional facilities from an [...]

  24. Peter222 says:
    March 31st, 2012 at 3:02 pm

    Netbeans is slow? Nowadays, when 4GB RAM and dual core is standard? I tried ST2, it is very promising but code completion is abysmally. So I stay with Netbeans to bigger projects and gedit-mate for quick editing.

  25. Luke Sturgess says:
    April 4th, 2012 at 4:41 pm

    Hi Stuart. Have you tried getting this Xdebug plugin to work https://github.com/Kindari/SublimeXdebug ?

  26. Nique says:
    April 21st, 2012 at 4:01 pm

    @Mandev,

    Netbeans crashes all the time here.. It was a good IDE.. now it is really F up.