Keyboard Shortcuts I Use All the Time

Guest Author

There's a couple of keyboard shortcuts I use all the time in NetBeans. Some of them might not be completely obvious, so maybe you can discover some useful timesavers here (I skip the most obvious ones like Ctrl-S or Ctrl-C). They save time because I don't have to switch my right hand to the mouse. Btw, I don't mostly use them in demos because it's better to use menus (shortcuts are not visible and thus would be magical), but in real life they're really handy:

Ctrl-E: deletes current line - very useful when deleting code :)

Alt-Enter: invokes the editor hint - you have to be on the line which is underlined with error mark so that this works(!)

Alt-Shift-F: fixes imports, faster than hints and knows how to resolve conflicts

Ctrl-Shift-F: reformats code, useful e.g. when cut & pasting code which is not properly formatted

Alt-Shift-O: open an arbitrary class, very fast, doesn't depend on package

Alt-left/right arrow: move to the class in the left/right opened editor

Ctrl-A: select all, works in all kinds of dialogs

Ctrl-1,2,3: move to projects/files/favorites

Ctrl-7, text: move to navigator and quick search for any method/field, enter to jump

Ctrl-mouse-click: navigate to the definition of any element in the source code (works also outside java code)

Ctrl-left/right arrow: jump one word left or right

Ctrl-G: go to line

Ctrl-K: code completion for losers

Ctrl-Space: if you don't know this one go shoot yourself :)

Alt-F4: time to go to sleep :)

Do you use any other ones which are convenient to get used to?

Join the discussion

Comments ( 17 )
  • Gregg Sporar Monday, June 26, 2006
    "Ctrl-K: code completion for losers"

    Hey! I resemble that remark! :-)
  • Nicolas Désy Monday, June 26, 2006
    Ctrl-Shift-T/D: comment/uncomment selected code (or current line)
    very useful :)
  • Dmitri Trembovetski Monday, June 26, 2006
    > Ctrl-Shift-F: reformats code, useful e.g. when cut & pasting code which is not properly formatted
    I find Ctrl+Shift+V quite useful when pasting as the new code gets automatically formatted..

  • Kovica Tuesday, June 27, 2006
    Ctrl+Shift+V doesn't reformat the code correctly.
    Try pasting code with a comment inside.
  • Jake Tuesday, June 27, 2006
    Ctrl-4 - Switching to the output window
    Ctrl-0 - Switching to the editor
    Alt-Up/Down - Copy Line up or down (only available if the LineTools by Sandip (http://blogs.sun.com/roller/page/scblog) are installed)
    Ctrl-Alt-Left/Right - next Camelcase word (only available by Sandip's tools) - with additional Shift it becomes marked
    Alt-K/L Forward/backward to the last, next position the cursor where.
    All the bookmark keys. That's a really cool feature
    @Roumen 1: the Alt-Left/right works in all parts of the IDE, e.g. you can switch from projects tab to files tab if they are located next to each other
    @Roumen 2: Why is Ctrl-K for losers? It's with large classes and a large code base, the much faster alternative to the normal code completion.
  • Eddy Young Tuesday, June 27, 2006
    Ctrl-Shift-F6 : Unit test results window
  • Khanh Quoc Ngoc Le Tuesday, June 27, 2006
    How about Ctrl-Z?
  • Eduardo Tuesday, June 27, 2006
    Ctrl-Y too
  • Eduardo Tuesday, June 27, 2006
    Ctrl-Y too... :)
  • Roumen Tuesday, June 27, 2006
    Ctrl-K for losers... it's kind of a "cheap" code completion, nothing really against it... ;)
  • Eduardo Costa Tuesday, June 27, 2006
    Some basic ones:
    Ctrl-F4/Ctrl-W: I really hate to have a lot of opened windows
    Alt-O: Just like Ctrl-click
    Ctrl-F/Ctrl-H: Let's search and destroy (replace, indeed)
  • Adrian Milliner Tuesday, June 27, 2006
    F9 - lets you see your Netbeans Windows + jconsole + your app + other windows all at once.
    Mac only.
  • Search Engines WEB Tuesday, June 27, 2006
    Control F - has been a timesaver for FINDING details in Long paged documents - works, even on WEBpages
    CONTROL H - Find and Replace - has been a time saver for many types of document Editing
    and on the WEB it brings up the HISTORY to search for previous URLs
    although, not technically a shortcut - RightClicking on any link and selecting the "open (link) in new window" option for the context menu - is extremely useful for power searchers
  • anybridge Wednesday, June 28, 2006
    Ctrl-C/Ctrl-V :)
  • Roumen Wednesday, June 28, 2006
    Are you a "cut&paste" programmer? :))
  • rufwork Thursday, June 29, 2006
    These are all very useful, but part of the overhead of essentially moving from one text editor to another. Is there an easy way to set everything up in, say, VIm compatibility mode? It's too bad no good VIm/[text editor of your choice] extension of Swing components exists yet (that I know of, anyway).
  • Roumen Thursday, June 29, 2006
    There are Emacs and Eclipse shortcuts available in NetBeans 5.5 but that won't satisfy you, I guess... anyone from community can create the shortcuts profile for vi and contribute it, it may then become part of the release :)
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.