Move from Netbeans to Sublime and never look back
February 2nd, 2013
Quite a while ago, I wrote an article on how we left Eclipse behind. Netbeans was the editor of choice back then, and what a party it was! Fast (we thought) and complete (we thought) and super simple (you guessed it: we thought). Back then I stated we'd NEVER go back to Eclipse, and that much is true.. but we did get annoyed with Netbeans, for more than one reason**.
We now all use Sublime Text, and we’re NEVER going back! There. I said it. Again
So here is my favorite improvements in SublimeText over Netbeans:
- No more spinning beach ball!
Okay so.. the spinning beachball was already gone, right? Right.. but Sublime is so blindingly fast it's just scary.
And the idea of finally getting rid of a Java-based tool was just too appealing. Sublime's written in
(corrected by NoxArt, ref. https://news.ycombinator.com/item?id=2822114)
Projects and files are just so easily gathered together, and switching between them is as easy as it gets [CMD-CRTL-P]. You can leave multiple projects open, switching between them as windows, or call somehing a "project" when it's just a bunch of files in a folder (like my local vhost configs). As happy as I was with the projects construct in Netbeans, SublimeText takes it six steps forward. And not little itty-bitty baby steps either.
- The configuration screen
Ehhmm.. first time I saw this I freaked out. There is no configuration screen. It's a textfile. But the freaking did not take long... when you think about it, having a text-based configuration file is a pretty good idea. That concept taken a step further borders on brilliant when you realize that almost anything (like a "search" for example) also results in a textfile.. that you can edit, save and -yes- search in.
- syntax hightlighting and code folding
It just works. In any color you like. In all languages (that I use anyway).
Ok so, all of these were a prerequisite before I'd even start to consider a change in editor. In fact, I was trying Sublime just to have a light-weight editor to quickly modify files when I didn'd have Netbeans open. But SublimeText is just so unexpectedly sublime when you use it, the following points aren't "improvements over Netbeans" at all. They're I-never-knew-I-could-have-this-in-my-editor points!
Hot *damn* this is schweet. You can get a multi-cursor by selecting multiple lines and [CMD-SHIFT-L], perfect for editing lists and converting them to SQL "in" type parameters.
Select the entire list, get crazy-multi-cursor-style, [CMD-left] to move to the beginning of the line and add a quote. [CMD-right] to move to the end of the line and add a quote and a comma. [right] to move all the cursors to the beginning of the next line and [BACKSPACE] to remove the newline and bring the entire list into one line. 7 seconds, where it took well.. euh.. I think I repressed the memory of how I used to solve this stuff before...
Multi-cursor after a search and you can edit all occurences of the match in-place at the same time, for renaming a variable or what not.
- commandline support
SublimeText comes with a command line binary that you can call with a line number and a column. This is handy on it's own, but combined with these instructions for clickable stack traces in XDebug it makes for a pretty short route from browser window containing an error to textfile containing said error. We know that there's the option of using XDebug directly from Sublime with a plugin, and we tried that, but that just felt like a little too much of a good thing. Simpler is better, and clicking from a stack trace straight into the file is awesome.
- goto anything
The name says it all.. you're in some file in the project, you want to go to anything else just [CMD-P] and type in something that looks like where you want to be at. Looking for a function inside a file? Add a @ and some more letters.. It's as natural as a google search, and just as fast.
There's tons of plugins out there already, and some of them pretty handy.. I'll list the ones I use for good measure, but there's mucht to explore in the plugins department. After you install SublimeText Package Control, you can just [CMD-SHIFT-P] and type "install" to find these quickly:
- Fast alignment: Alignment
- Jump to PHP docs quickly: Goto Documentation
- INI file syntax highlighting: INI
- Twig syntax: PHP-Twig
- A smarter sidebar: SideBarEnhancements
- A linter to check your code for syntax errors: SublimeLinter
We recently also started using CTags and CTags for PHP, and avoid slow plugins like CodeIntel, but this is the source of another article.
So there it is. My raving review of SublimeText. As usual, whatever I'm using now is the best thing since sliced bread - or at least the best thing since people started putting grilled meat on sliced bread. So take my article with a few grains of salt, but do try out Sublime. They don't call it "the editor you'll fall in love with" for nothing...
** The biggest frustration we had with Netbeans was not being able to upgrade to SVN 1.7... we don't actually use SVN anymore, we switched to GIT, but we also don't use SVN/GIT commands from editors.
Pointy haired boss