.
.   
NEdit.org
   .

Home
 - News - Download - Documentation - Search - FTP     
.
.
  

Fold C/C++

[Back]

fold.nm

These (rather nasty) outline mechanism macros are intended for use with C/C++. One collapses matching brackets, parentheses, etc., to a single line, using control characters as separators. This line is a fold. Another expands the first fold on the current line.

You can nest folds.

The first C/C++ comment following the first bracket of the fold is converted into a fold comment, to remind you what's going on inside.

Setting up highlighting (such as making fold comments stand out but making the fold content dim) helps make these folds useful.

Fold

# Collapses the current selection if there is one, or
# all text between match()-brackets.

if ($selection_start != -1)
  fold_selection()
else
  fold_bracket_match()

Unfold

# Expands the first fold found on the current line, or
# the next fold found in the file.

fold_expand()

Here are some highlight patterns, be careful about the ^L's - they should be form feed characters.
fold:"^L":"^L\\n"::Fold::
fold comment:"(\\[\\[\\[)[^\\|]*(\\|\\|\\|)":::FoldComment:fold:
fold comment boundary:"\\1\\2":""::Fold:fold comment:C
[Back]

. Released on  Wed, 21 Nov 2001  by C. Denat  

  
Visit our sponsor
Check Metrolink

© NEdit.org
1999-2001
All rights reserved


.