Notepad++ expand/collapse block with keyboard

53

12

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.

Gab

Posted 2013-09-18T15:45:34.880

Reputation: 887

Answers

46

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

Soosh

Posted 2013-09-18T15:45:34.880

Reputation: 584

6

The shortcut alt+0 for fold all and alt+shift+0 for unfold all. http://superuser.com/questions/436023/how-to-expand-collapse-all-blocks-of-ruby-code-in-notepad

– Mhmd – 2015-06-07T05:32:35.340

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 – 2019-06-16T10:53:02.323

expansion is not working for me (.py file) – joey baruch – 2019-12-02T02:55:43.903

@joeybaruch it is working for me for .py file and I'm using v7.8.1 (64-bit). maybe you should update yours. – Soosh – 2019-12-07T10:42:27.823

51

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

Paschi

Posted 2013-09-18T15:45:34.880

Reputation: 640

2Please 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 – 2015-11-17T15:21:20.907

-1

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

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

Thiru

Posted 2013-09-18T15:45:34.880

Reputation: 1

1I don't think your command does what OP described. However, it seems to do something. Care to explain what and how? – Konrad Viltersten – 2014-12-05T15:11:16.947

Please care. In my Notepad++ alt-3 is confusingly mapped to a command named 3. – bzlm – 2015-09-25T08:31:12.463