Reputation: 41827
I've recently gotten quite fond of netbeans for my php work because of the XDebug integration. It has made me all but forget about textmate (which imho still beats netbeans for the little things)
What do you think is the one awesome netbeans feature I should know about, and more importantly why and how do I use it?
I'm asking this to optimize my skills in the use of the IDE and based on the idea that what works well for others might just work for me (and hopefully others).
Upvotes: 44
Views: 8775
Reputation: 827198
The Subversion Integration directly on the IDE and the Local History are of my must-use, favorite features.
Upvotes: 26
Reputation: 7168
This link has a lot of keyboard shortcuts that comes in handy. I have a copy of it printed out and pinned to the wall next to my computer. Sadly, I don't see any special PHP shortcuts though.
UPDATE: http://netbeans.org/project_downloads/usersguide/shortcuts60.pdf UPDATE2: http://netbeans.org/project_downloads/www/shortcuts.pdf (for 7.0)
Upvotes: 9
Reputation: 1478
its amazing that no one has talked about this cool plugin.
http://code.google.com/p/zen-coding/
I have found it very useful for html. PHP developers do need it. It adds a lot of templates like this.
download zen-coding for netbeans and import zip file in tools>options>code templates>import.
Upvotes: 2
Reputation: 5118
NetBeans also allows you to completely undock individual windows.
How to:
Right-click on toolbar of the window which you want to move and select Undock window
. The selected window becomes a floating one, which allows you to move it outside of the main NetBeans window.
Highlights:
This is useful especially if you have a second monitor, as it allows you to maximize the space available for source code by moving any supplementary windows (the file browser, unit test results, etc) away from the main screen. The nice thing is that NetBeans works around most annoyances which are usually present in multi-window applications (e.g. different applications covering individual toolbars in GIMP).
Note: perhaps this is commonly known feature, but I managed to discover it just today. It wasn't on the list yet, so I added it even though I already answered with a different feature some time ago.
Upvotes: 4
Reputation: 393
Macros, and Code Templates with advanced input !
Parametrized code templates (try typing fnc in netbeans and then imediately press Tab, and then keep pressing Tab to see what happens, how it cycles through the function name and the function parameters - look inside the code template to see how this is done). (Options > Editor > Code Templates )
Some easy examples (some I made, some come with netbeans):
EDIT: You can make a code template for the arrow with a single letter (like 'm' for ex) , but when you type in code you have to put a space before the letter, else it wont recognize it. Ex: $obj m[press Tab], expands to [$obj ->]. The space inbetween works ok and is not a sintax error. /EDIT
Every time I wish there was a template for something, I actually insert the template and then use it imediately and continue with the rest of the php programming.
Macros with shortcuts as mini code templates ! (Netbeans >Menu > Edit >Start / Stop Macro Recording)
Best Macros I made for php are actually Code Templates (because ' + Tab doesnt work as code template for some reason, only if the template begins with a letter it works) ([shortcut] inserts [text]):
Upvotes: 11
Reputation: 11216
Netbeans has always been known for delivering support for experimental (not-yet-released) technologies, such as Java 6 EE preview, JDK7 support, ...
And, subversion support out-of-the box. It's a great difference to Eclipse, where you have to use plug-ins. With Eclipse I had only problems under Linux (JavaHL problems, blabla...). I don't remember who said it, or where it is written, but "out-of-the-box support is much more relevant to a user than the ability to use some plug-ins".
Upvotes: 1
Reputation: 5118
I would add Tasks integration. Don't have time to finalize something? Add a simple task which NetBeans will track for you. You can customize what gets tracked in Tasks in Options -> Miscellaneous -> Tasks
, but I found the format below to be most useful, as it aligns well with PHPDoc comments (see therefromhere's comment):
/**
* @todo Create public setters and __toString() for this class.
*/
Upvotes: 8
Reputation: 44074
if ($x instanceof SomeClass) {
$x->.... // now it has code completion with SomeClass' methods.
}
Upvotes: 13
Reputation: 55271
I find the single most useful feature in Netbeans for PHP work is that it understands PHPDoc (in the same way that it understands Javadoc), and uses it for type hinting.
Type /**
before a function definition, hit return and it'll create a PHPDoc template.
/** <-- I typed this one line
* @param <type> $otherObj <-- Netbeans added these 3 lines
* @return <type> <--
*/ <--
public function exampleFunction($otherObj)
{
$myObj = new MyClass($otherObj);
return $myObj;
}
Replace the <type>
placemarkers with the appropriate types:
/**
* @param OtherClass $otherObj
* @return MyClass
*/
public function exampleFunction($otherObj)
{
$myObj = new MyClass($otherObj);
return $myObj;
}
And voila, you'll get type completion (and pop-up documentation) with Ctrl-space.
Upvotes: 19
Reputation: 69747
This is going to sound ridiculously trivial, but one thing I do in Netbeans is code formatting. Its code formatting (source->format) rocks.
Its SVN integration is great too, but that's already been said.
Upvotes: 6
Reputation: 41827
I've found another great snip of genius i wanted to share:
you can do custom code folding (not really related to php, just netbeans)
just put this into a code file:
// <editor-fold defaultstate="collapsed" desc="getters and setters">
some boring code you don't need to see every time here
// </editor-fold>
That'll behave similar to #region
s in visual studio or pragma mark
s in xcode. but unlike region
s, it doesn't screw up the working of your code, it's really just a comment!
Upvotes: 43
Reputation: 168
I've personally used Eclipse a couple of years ago for Java development, and ever since i knew Netbeans at version 3.5, it has gotten really good with the integration of server technologies as TomCat for J2EE application deployment, subversion, uml and plenty of plug-ins for different tecnologies, not just java now.
Upvotes: 1
Reputation: 22065
TextMate is a great slick little editor I use all the time on my Mac, but not an IDE. I haven't enjoyed Netbeans on Mac very much being so non-native, but on Windows or Linux I prefer it over Eclipse.
Upvotes: 2
Reputation:
Some features definitely worth looking out for, including the ones mentioned above:
Upvotes: 2
Reputation: 1108
maybe the search box, to find anything in the source code`?
Upvotes: 2
Reputation: 508
If you consider Netbeans 6.7 it has a sync feature a bit like Dreamweaver
In the way that you can add a custom ftp, import it to the project and when you save the files locally they are also uploaded to the server so you have a semi backup system in place.
(trust me it's better than working directly onto a ftp tree and realizing that the transfer failed somehow between the current tmp file and the server file and you lost your work because you closed the file window :) )
Upvotes: 5
Reputation: 6968
Ctrl + Space is my favorite and most used feature when programming in java, I think it is enabled for PHP as well. But if you like net beans you most likely know about it already, if not try it out discover what it does.
Also navigating to the relevant source code by Ctrl + Clicking on anything from variables, to method calls, to class references is a nice feature.
Additionally, the popup menus that are displayed when right clicking in source code contain many useful tools for everything from refactoring to code generation.
Upvotes: 6
Reputation: 96
The ability to create quick on the fly macros.
For example , here is one that will put a semi-colon at the end of the current line and places your cursor back where it was before the macro started.
";" delete-previous caret-end-line ";" jump-list-last-edit jump-list-last-edit (I know this is present in other language implementations by default. But it does not work by default in PHP Netbeans.)
As someone who tends to stick with IDE for a long time, I love being able to customize little things to make me more efficient.
Upvotes: 5