About: Fold C-style comments   Sponge Permalink

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

You can add folding capability to C-style comments using the command: au BufNewFile,BufRead *.cpp,*.c,*.h,*.java syn region myCComment start="/\*" end="\*/" fold keepend transparent This will work on C, .h, C++, and Java files. The "keepend" and "transparent" commands are necessary to avoid overriding the default syntax highlighting of comments. If you want to keep the "/*" beginning of the comment in the folded text, you can use the following function: The resulting line should look about the same as the default, without removing the comments.

AttributesValues
rdfs:label
  • Fold C-style comments
rdfs:comment
  • You can add folding capability to C-style comments using the command: au BufNewFile,BufRead *.cpp,*.c,*.h,*.java syn region myCComment start="/\*" end="\*/" fold keepend transparent This will work on C, .h, C++, and Java files. The "keepend" and "transparent" commands are necessary to avoid overriding the default syntax highlighting of comments. If you want to keep the "/*" beginning of the comment in the folded text, you can use the following function: The resulting line should look about the same as the default, without removing the comments.
Version
  • 6(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 873(xsd:integer)
Category
  • C
  • Folding
Author
  • David Vos
Complexity
  • intermediate
Created
  • 2005-02-11(xsd:date)
ID
  • 874(xsd:integer)
NEXT
  • 875(xsd:integer)
Rating
  • 5(xsd:integer)
abstract
  • You can add folding capability to C-style comments using the command: au BufNewFile,BufRead *.cpp,*.c,*.h,*.java syn region myCComment start="/\*" end="\*/" fold keepend transparent This will work on C, .h, C++, and Java files. The "keepend" and "transparent" commands are necessary to avoid overriding the default syntax highlighting of comments. If you want to keep the "/*" beginning of the comment in the folded text, you can use the following function: set foldtext=MyFoldText() function MyFoldText() let line = getline(v:foldstart) let sub = substitute(line, '^[ ]*', '', '') let nlines = v:foldend - v:foldstart + 1 if strlen(nlines) == 1 let nlines = " " . nlines elseif strlen(nlines) == 2 let nlines = " " . nlines endif return "+-" . v:folddashes . nlines . ": " . sub endfunction The resulting line should look about the same as the default, without removing the comments.
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