www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Allow folding code with vim

reply bioinfornatics <bioinfornatics fedoraproject.org> writes:
hi,

with vim you can fold unfold command to do this you need  to ad to d.vim
these lines

" Folding
syn region dFold start=3D"{" end=3D"}" transparent fold
syn region dOnelineCondition start=3D"\<if\>\|\<else\>\|\<else\s\+if\>"
end=3D";" contains=3DALL containedin=3DALL transparent fold
syn region foldDdoc1 start=3D"/\*\*" end=3D"\*/" keepend transparent fold
syn region foldDdoc2 start=3D"/++" end=3D"+/" keepend transparent fold


and into /.vimrc add
set foldmethod=3Dsyntax

vim folding in
- French:
http://qanuq.com/index.php?post/2009/04/13/Utiliser-les-replis-%
28folding%29-de-Vim

- English: http://vim.wikia.com/wiki/Folding
Jun 23 2012
parent "Jesse Phillips" <jessekphillips+D gmail.com> writes:
On Saturday, 23 June 2012 at 16:40:16 UTC, bioinfornatics wrote:
 hi,

 with vim you can fold unfold command to do this you need  to ad 
 to d.vim
 these lines

 " Folding
 syn region dFold start="{" end="}" transparent fold
 syn region dOnelineCondition 
 start="\<if\>\|\<else\>\|\<else\s\+if\>"
 end=";" contains=ALL containedin=ALL transparent fold
 syn region foldDdoc1 start="/\*\*" end="\*/" keepend 
 transparent fold
 syn region foldDdoc2 start="/++" end="+/" keepend transparent 
 fold


 and into /.vimrc add
 set foldmethod=syntax

 vim folding in
 - French:
 http://qanuq.com/index.php?post/2009/04/13/Utiliser-les-replis-%
 28folding%29-de-Vim

 - English: http://vim.wikia.com/wiki/Folding

Folding was added with this commit. https://github.com/JesseKPhillips/d.vim/commit/bc5fd07cddb76407ef441c3ed5fe6c9054e630d6 Though it doesn't do anything special for doc comments or if/else. I don't use code folding so I don't know what is appropriate, but the github page is the place to add items that should go back upstream. If you can explain what this adds over what already exists it would probably be easier to decide if appropriate and test.
Jun 23 2012