Monday, March 28, 2011

Is there a keyboard shortcut in Eclipse to fold the current method/block?

Hey, question says it all. I have folding turned on in Eclipse (v3.4), and rather than having to click the little +/- in the page gutter, I'm wondering if there's a keyboard shortcut to just "fold the current method". A quick look at the menus and what-not in eclipse doesn't show a menu item for it, so maybe you just can't do it.

Anyone?

From stackoverflow
  • By default they're bound to Ctl-Numpad_Minus and Ctl-Numpad_Plus, but you can rebind them.

  • To expand on petrilli's answer:

    • Ctrl+Numpad_Multiply can also be used to expand all
    • Ctrl+Shift+Numpad_Divide is bound to collapse all
    • Ctrl+Numpad_Divide toggles folding on and off

    And yes, they can all be rebound, if you know what text to filter on in Windows | Preferences | General | Keys.

    "Folding", "Expand", "Collapse" are keywords that should get you all of the relevant commands.

    DutrowLLC : Thank you, this was really helpful.

0 comments:

Post a Comment