Folding

Folding refers to the ability of the editor to selectively hide parts of the file in order to give a better overview of the whole file. This may be used to rapidly find sections in the text. The folding control keys are as follows:



                        

Folding Keys

Ctrl v first column lines only
Alt v changed lines only
Alt s lines containing search string only
Alt h lines containing place mark only
Alt - Fold to next lower fold tag
Alt + Unfold to next greater fold tag
Ctrl - Fold to next tab position to left
Ctrl + Unfold to next tab position to right

The first 4 of these commands are toggles i.e. hitting Ctrl v twice returns the file to the unfolded state. Only one type of folding may be active at any one time. The file may be fully edited while folded but marked blocks can not be transferred across folds. These commands are useful for rapidly finding a section of the file.

Ctrl v causes only lines starting in the first column to be displayed. If the text is organized so that only section headings or sub-routine headings start in the first column then Ctrl v can be used to rapidly locate a section in a file. To do this hit Ctrl v then move cursor to desired sub-routine heading and hit Ctrl v to expand again. Alt v and Alt s work similarly except they show only changed lines and lines containing the last search string respectively. For example in a large case statement the start of any branch may be found by doing a search for ``case'' and then selecting Alt s. This will show only lines containing the word ``case'' on the screen. The cursor may then be put on the desired line and the file expanded again. Alt h can be used to view only lines on which a place mark has been previously set using Ctrl a. When folded the visible lines may still be edited.

The Alt - and Alt + pair are complementary keys and unlike the toggles above several levels of this type of folding are possible. To use this folding mechanism fold tags must be inserted in the text. By default these are of the form // Lnnn where nnn is an integer. This is in the form of a C++ comment and can thus be put into source code without perturbing the program. The form of the tag string may be edited in the config dialog by changing the fold tag regular expression. Note that the fold tags must contain an integer counter as part of the tag. The first time Alt - is hit the largest value of all the found fold tags is found and the lines between tags of this number and tags with smaller numbers are hidden. A subsequent Alt - will decrement the folding tag number and hide more lines. Thus multiple levels of folding are possible with this mechanism. An Alt + will increment the fold tag number and reveal the corresponding hidden lines. A sufficient number of Alt + hits will return the file to its unfolded state. This folding mechanism differs from the others since the file must be modified to contain the fold tags as special comments but it has the flexibility to place fold markers anywhere in the file. This type of folding is not available in the version of the editor bundled with Splot.

The Ctrl - and Ctrl + pair is similar in operation to Alt - Alt + but does not use fold tags. Instead on the first Ctrl - the greatest number of tab indentations (depends on the set tab size) on the current page is determined and the file folded to hide all the lines indented this far. A further Ctrl - decrements this number and hides more lines. Ctrl + counter acts a Ctrl -. This type of folding is useful with structured program code that uses a tab indentation to delineate a block. Thus for example the start of both branches of an if else block may be seen by hiding the bodies. This type of folding is not available in the version of the editor bundled with Splot.