About: Customize text for closed folds   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

The foldtext function below does three things: * Is less intrusive when displaying code, and right-aligns the number of lines in the fold. * Collapses folds that start and end on braces with everything between the braces replaced with {...}. * Tries to collapse multiline comments with the first non-blank line in the comment. Outstanding issues: I also use the following highlights with white backgrounded source to visually set the folds apart from non-folded lines, while trying to keep a nice aesthetic.

AttributesValues
rdfs:label
  • Customize text for closed folds
rdfs:comment
  • The foldtext function below does three things: * Is less intrusive when displaying code, and right-aligns the number of lines in the fold. * Collapses folds that start and end on braces with everything between the braces replaced with {...}. * Tries to collapse multiline comments with the first non-blank line in the comment. Outstanding issues: I also use the following highlights with white backgrounded source to visually set the folds apart from non-folded lines, while trying to keep a nice aesthetic.
Version
  • 7(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 1546(xsd:integer)
Category
  • Folding
Author
  • Edouard
Subpage
  • /200803
Complexity
  • basic
Created
  • 2008-03-04(xsd:date)
ID
  • 1547(xsd:integer)
NEXT
  • 1548(xsd:integer)
abstract
  • The foldtext function below does three things: * Is less intrusive when displaying code, and right-aligns the number of lines in the fold. * Collapses folds that start and end on braces with everything between the braces replaced with {...}. * Tries to collapse multiline comments with the first non-blank line in the comment. Outstanding issues: * Right alignment may not work with signs turned on. * Tabs mess up the in-place display of the initial '{'. " Set a nicer foldtext function set foldtext=MyFoldText() function! MyFoldText() let line = getline(v:foldstart) if match( line, '^[ ]*\(\/\*\|\/\/\)[*/\\]*[ ]*$' ) == 0 let initial = substitute( line, '^\([ ]\)*\(\/\*\|\/\/\)\(.*\)', '\1\2', '' ) let linenum = v:foldstart + 1 while linenum < v:foldend let line = getline( linenum ) let comment_content = substitute( line, '^\([ \/\*]*\)\(.*\)$', '\2', 'g' ) if comment_content != '' break endif let linenum = linenum + 1 endwhile let sub = initial . ' ' . comment_content else let sub = line let startbrace = substitute( line, '^.*{[ ]*$', '{', 'g') if startbrace == '{' let line = getline(v:foldend) let endbrace = substitute( line, '^[ ]*}\(.*\)$', '}', 'g') if endbrace == '}' let sub = sub.substitute( line, '^[ ]*}\(.*\)$', '...}\1', 'g') endif endif endif let n = v:foldend - v:foldstart + 1 let info = " " . n . " lines" let sub = sub . " " let num_w = getwinvar( 0, '&number' ) * getwinvar( 0, '&numberwidth' ) let fold_w = getwinvar( 0, '&foldcolumn' ) let sub = strpart( sub, 0, winwidth(0) - strlen( info ) - num_w - fold_w - 1 ) return sub . info endfunction I also use the following highlights with white backgrounded source to visually set the folds apart from non-folded lines, while trying to keep a nice aesthetic. highlight FoldColumn gui=bold guifg=grey65 guibg=Grey90 highlight Folded gui=italic guifg=Black guibg=Grey90 highlight LineNr gui=NONE guifg=grey60 guibg=Grey90
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software