Fold / Unfold All option? lazarus / 9-Editor ---------------------------------------------------------------------- Hansaplast · 2011-01-16 18:22 I really like to Fold/Unfold option in the editor, as well as the fact that it actually saves the state of a procedure/function being folded or not. It also makes perfectly sense that a procedure/function unfolds during debugging. However; it is a little annoying that after each run I find myself folding all procedures again. Is there an option to basically say "Fold All" (so the editor folds all procedures) so can easier scroll through my code? ---------------------------------------------------------------------- Martin_fr · 2011-01-16 19:08 QuoteIt also makes perfectly sense that a procedure/function unfolds during debugging. You mean when you step into it, or reach a breakpoint inside? Otherwise it shouldn't... ----- There a keyboard shortcuts, you can change them. By default they are shift-alt-num "num" being a digit from the normal 1..0 (above the letters) / not from the numeric block. "0" unfolds all 1 folds all 2 folds all at nesting level 2 (the most outer folding blocks are not folded, ony nested folds) 3 folds at level 3 The levels are not about procedures, but about any pascal-foldable node. If you enable folding for unit-sections (interface, implementation), then "1" will fold those) .... IFDEF and REGION are not taken in account, and can not be folded that way. Comments can be toggled, by making a selection, and then using the context/pop-up menu, above the fold-part of the gutter. ---------------------------------------------------------------------- Hansaplast · 2011-01-16 19:22 Quote from: Martin_fr on January 16, 2011, 08:08:37 pmThere a keyboard shortcuts, you can change them. By default they are shift-alt-num "num" being a digit from the normal 1..0 (above the letters) / not from the numeric block. "0" unfolds all 1 folds all 2 folds all at nesting level 2 (the most outer folding blocks are not folded, ony nested folds) 3 folds at level 3 Thanks for taking the effort to explain this! This is exactly what I was looking for ... However,... these shortcuts do not seem to work on a Mac shift-alt-1 generates a "⁄" instead. I tried other key combinations but it's not working with any of them Edit: I just looked at the mappings, the folding/unfolding features have no keys assigned under MacOS ... Assigning Shift-Alt-1 doesn't work - I'll try some other keys. Is there any documentation of key schemes? Never mind I picked the "Classic" scheme which did the trick. Not sure what key combo's are no longer working now, but I'll find out Thanks again! ---------------------------------------------------------------------- Martin_fr · 2011-01-16 20:16 I don't know the mac..., but you can assign it to any key you like, any key that is not yet used, and that is not used by the OS neither.... So you do not have to give up the keyboard shceme that you are used to. You will have seen: You can assign a key to trigger fold/unfold on the line of caret. If there is a [ +]/[-] symbol at this line In fact, in order to fold (shift-alt-minus) you don.t have to be on the [-] line, you can be anywhere inside the foldable block, it looks for the next outer block --- Also if interested, the advanced mouse options (there is a wiki help, via F1) allow for folding by clicking on a "begin" or "procedure" so in a Line like      if a=1 then begin  if b=2 then begin You can choose which of the 2 blocks to fold. You can also configure fold by clicking (right/left/middle, double, ctrl, shift, alt,....) on the vertical line (of the fold gutter) or text inside a foldable block. ---------------------------------------------------------------------- Hansaplast · 2011-01-21 05:50 Thanks again Martin_fr Well, I found out that none of the keymappings for MacOS (Lazarus and Apple style) have folding/unfolding mapped at all So I added SHIFT+ALT+1 for folding all and SHIFT+ALT+0 for unfolding all, using the "MacOS (Lazarus style)" scheme. For newbies like myself that are interested how to do this or how I'm using this: Go to the Lazarus menu "Environment" - "Options" - "Key Mappings". In the filter box type "fold" so you can see what keys have been assigned by the scheme you picked (I picked "MacOS (Lazarus style)" throught the "Choose Scheme" button). To assign one or more key combo's, double click the command you're looking for, for example "Fold to Level 1" and a window opens. Under the section "Key" you will see Shift, Alt, Ctrl, Meta (Cmd or Apple Key), an edit box and a "Grab Key" button. Click the top most "Grab Key" button and a small window will open saying "Press a key". Press SHIFT+ALT+1 (for this example) and it registers the key stroke. Click OK and you're done for this command. (I use SHIFT+ALT+0 to "Unfold All", set in a similar fashion). When you're done assigning keys, click "OK". Now this is all nice and dandy, but I really only want to have things folded on the first level (ie. procedures, functions, etc) and not the other levels (begin … end, etc). To set this, go to "Environment" - "Options" - "Code Folding". Uncheck everything except "Procedure" and click "OK". And there ya go - keep in mind, I'm relatively new to Lazarus so there might be easier ways and I might not always use the right expressions Just though it might be useful to someone