66

My question is pretty straight-forward, is there a way in Notepad++ to expand and collapse blocks with keyboard shortcut? I already know about the alt+0 and alt+shift+0 to expand / collapse all blocks but i want to achieve this for a single block.

The behavior i want to reproduce is when you click the little +/- symbol near a code or xml block but with keyboard only.

3 Answers 3

57

Ctrl+Alt+F collapse current level and Ctrl+Alt+Shift+F expand it.

5
  • 13
    The shortcut alt+0 for fold all and alt+shift+0 for unfold all. superuser.com/questions/436023/…
    – Mhmd
    Jun 7, 2015 at 5:32
  • This answer is not true if you didn't select any Language from Editor and you are working with simple .txt file text blocks.
    – user806202
    Jun 16, 2019 at 10:53
  • expansion is not working for me (.py file) Dec 2, 2019 at 2:55
  • @joeybaruch it is working for me for .py file and I'm using v7.8.1 (64-bit). maybe you should update yours.
    – Soosh
    Dec 7, 2019 at 10:42
  • @user806202 how could you collapse/expand an "unknown" language? Each language does it different... brackets, spacing, etc
    – WernerCD
    Nov 28, 2020 at 18:22
69

In short:
Alt+0 folds (collapses) all Blocks
Alt+1 folds all Level 1
Alt+2 folds all Level 2
Alt+x etc.

and
Alt+Shift+0 Unfolds all
Alt+Shift+1 Unfolds Level 1
Alt+Shift+2 Unfolds Level 2
Alt+Shift+3 Unfolds Level 3
Alt+Shift+x etc.

And yes, bzlm, in the ShortCut Mapper, in the Menu 'Settings', the command Alt+3 is mapped to a Command named 3. This one is below the command Collapse Current Level, so the meaning is Collapse Level 3 or Fold all Level 3 Blocks

1
  • 2
    Please read the question again carefully. Your answer does not answer the original question. None of your shortcuts will expand/collapse a single block which is what the question asked for. This answer may be a comment on another answer, but it doesn't answer the question.
    – DavidPostill
    Nov 17, 2015 at 15:21
-1

Try using ALT-3 and for element level condense and collapse.

This will condense all siblings of the root node one by one.

2
  • 1
    I don't think your command does what OP described. However, it seems to do something. Care to explain what and how? Dec 5, 2014 at 15:11
  • Please care. In my Notepad++ alt-3 is confusingly mapped to a command named 3.
    – bzlm
    Sep 25, 2015 at 8:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .