It’s been several days that I am relying solely on NetBeans for my PHP and Java coding. So far, it’s beyond my wildest expectations – I am totally satisfied with that great IDE. Today, I have searched for shortcut that would allow me to duplicate a given line, and (fortunately!) came by a great post – Top 10 NetBeans IDE Keyboard Shortcuts. Not only I found the line-duplication thing, I discovered several other pearls which due to unavailability in my previous IDEs, I even didn’t consider to look for.

So, I decided to compile my own list of shortcuts that save me a lot of time during code-sessions.

Shift + Esc Toggle Work-space Maximize/Minimize

Like the original post author, I really like to have as much work-space available for code itself as possible. And when I occasionally need to see one of the supplementary panels (like Files, Project, Navigator etc), I rely mostly on short-cuts, w/o toggling back. So, if I need to view some docking panel I hit one of the following:

Ctrl+1 – Project Window
Ctrl+2 – Files Window
Ctrl+3 – Favorite Window
Ctrl+4 – Output Window
Ctrl+5 – Services window
Ctrl+6 – Tasks Window

and when I am done, Ctrl+0 to get me back to editor. Try for yourself, I am pretty sure, you’d be amazed how much time this saves you, while making coding area less cluttered.

Alt+Enter View fix suggestions

NetBeans makes your life a lot easier, its Java code analyzer does a really solid job. Most of errors are filtered even before compilation – should you see the light bulb on the left of your code, you can review fix suggestions by either clicking on it or (time-saver again!) by just hitting Alt+Enter. I personally enjoy this one, as I prefer to see why IDE is complaining w/o releasing my hands of the keyboard.

Ctrl+F12 Navigate to Member

If your class is too big, then Members View in Navigator (Ctrl+7 remember?) might not be the best option. Just hit Ctrl+F12 and you’d be able to navigate more easily, as it has filter that would eliminate non-matching members while you are typing.

Alt+Insert Generate code

That’s one of my favorites – code generators for getters/setters/constructors are just too sexy to ignore. This shortcut makes them even more usefull.

Ctrl+Shift+ArrowDown Duplicate Line

Duplicating lines never been easier :) If you want a new duplicate to be inserted before the current line, use ArrowUp instead of ArrowDown.

Ctrl+W Close Current Window

Firefox honors this short-cut, as well as Konqueror. So, I even configured my console to use this by default. In no time you’d be accustomed to hit this combination instead of Ctrl+F4.

Ctrl+PgUp and Ctrl+PgDn Navigate through Windows (previous/next)

Again, got used to it from Firefox. Makes it a swift to loop through open documents.

Ctrl+P Display method’s arguments

Within method’s braces hit this combination to see what parameters are there. Comes where handy when reviewing the code.

Ctrl+; Add semicolon to the end of the line w/o leaving current cursor position

If you are working on some code line and NetBeans underlines it red (due to [yet] non-existent semicolon at the end of the line) hitting Ctrl + ; (Ctrl + semicolon) is enough to close the statement, while you are still positioned at the very same place on line. First saw this on dzone.com blog, and really liked using it.

Ctrl+K and Ctrl+L Auto complete with previous/next matched word

I use this combination even more often than Ctrl+Space to auto complete. Listing all items with Ctrl+Space might be slow, but hitting Ctrl+K is instant. More than often the variable name you are typing is already typed somewhere in the current file, thus matching it with Ctrl+K or Ctrl+L is probably most obvious thing to do.

Ctrl+E Delete current line

Ctrl+Del and Ctrl+BackSpace Delete next/previous word

I generally use Ctrl+BackSpace, but on some occasions Ctrl+Del also proved userful.

That’s more than enough to get you going. In some time, I plan to write more extensive list  of esoteric shortcuts you rarely use, because you rarely know about them.

And what shortcuts save your time?

  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Reddit
  • Technorati
  • email
  • Print
  • DZone
  • eKudos
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • Twitter
,
Trackback

17 comments untill now

  1. [...] the original here: Extremely Usefull NetBeans Shortcuts Related ArticlesBookmarksTags Netbeans 6.5 RC 2 available . 1 IDE aja udah lengkap : Java [...]

  2. I have been scratching my head how to get the Complete line function to work (add semicolon to end of line). Until I realized that there is a known bug that it doesn’t work in PHP, works fine in Java.

  3. You are right – some short-cuts do not work in PHP, but everything described would certainly work in Java (as NetBeans was first a Java editor, it’s only now other languages support had been added). Any way, editor become more mature with every single release, so this bugs would certainly go away in next milestone. Thanks for pointing this out..

  4. You can add CTRL+SEMICOLON to NetBeans PHP by recording a macro:
    1) Begin macro recording
    2) Press the END key
    3) Press the SEMICOLON key
    4) End macro recording and assign the keyboard shortcut CTRL+SEMICOLON to your new macro

  5. @Blake

    Good tip with the macro, however it will not change the cursor position back to the original position, instead it will stay at the end of the line :S

  6. Modified Blakes idea.

    Make a change then delete it to add a item in edit history for that cursor position. Move to end of line, add semicolon. Then iterate up the list of edit positions to original position.

    Kinda odd way to get there, but it works. /shrug

    —-

    “;” delete-previous caret-end-line “;” jump-list-last-edit jump-list-last-edit

  7. Hallelujah! You guys are fucking awesome. I’ve been trawling all over the web looking for a solution to the ending-semicolon problem (is it possible its a mac issue?) and your macro shortcut is the PERFECT SOLUTION. Between the two of you both forms are accounted for (and IMHO they are both useful).

    I set up META+; to be “add a semicolon and press enter” and META+SHIFT+; to be “add semicolon and return to position”.

    NOTE: RFS’s solution totally works but WordPress is breaking the quotes by making them curly. Use this instead (i’m putting it in a code tag so it should look right)

    ENDING SEMICOLON MAINTAIN POSITION
    ";" delete-previous caret-end-line ";" jump-list-last-edit jump-list-last-edit

    ENDING SEMICOLON NEWLINE
    caret-end-line ";" insert-break

  8. Thanks for posting on this. Been using NetBeans since 6.5 RC days for my PHP work. The semicolon workaround is quite nice. Most of the time I find myself just codewalking with keyboard shortcuts: Ctrl-O to go to class, Ctrl-Shift-O to go to file.

  9. Pavel,
    Good points! Yes, I find Ctrl+O particularly useful for jumping through the code.

  10. Setiawan @ 2009-08-13 06:09

    Thanks for this posting.

    I’m Using Netbeans for PHP 6.7 and the Ctrl+PgUp and Ctrl+PgDn to navigate through Windows (previous/next) doesn’t work.

    Thank you.

  11. Tomas Mysik @ 2009-08-13 16:51

    CTRL + ALT + SHIFT + o – go to symbol

  12. Is there a way to turn off error-checking-as-you-type?? I’m using NB 6.7 with PHP and this feature is making me pull out my hair!!!!

    Thanks!

  13. If you find that a block of code has got a bit mis-aligned, select it and press Alt+Shift+F, Netbeans will get it back into shape for you, correct the indentation, etc. Sweet.

  14. [...] N?tzliche Netbeans Shortcuts bzw. unter Tools->Options->Keymap k?nnen s?mtliche Shortcuts gefunden und konfiguriert werden [...]

  15. Another extremely useful short cut is:

    CTRL+BACK_QUOTE (`) for switching back to the previous file that you edited. Very useful for navigating between relevant files that you are editing…

  16. [...] via PHP Magazine » Extremely Usefull NetBeans Shortcuts. [...]

  17. There is a typo in the following section.

    Alt+Insert Generate code
    That’s one of my favorites – code generators for getters/setters/constructors are just too sexy to ignore. This shortcut makes them even more usefull.

    There should be 1 ‘l’ not 2 ‘ll’s.

Add your comment now