On Jun 21, 9:51 pm, SamPeng <[email protected]> wrote:
> My HTML files too long!I want it working like PHP files folding.How to do
> it?

First, please bottom-post to this list, as detailed here:
http://groups.google.com/group/vim_use/web/vim-information

Secondly, you may find useful what I have in $HOME/vimfiles/after/
syntax/html.vim (I'm on Windows, if on Unix use .vim instead of
vimfiles):


" add folding of tags, except for those that have no closing tag (must
close
" optional tags though, or the folding will be thrown off)
syn region SynFold
      \ start="\v\<%(param|link|isindex|input|hr|frame|col|br|basefont|
base|area|img|meta)@!\z([a-z]+)%(\_s[^>]*[^>/])*\>"
      \ end="</\z1>"
      \ transparent fold keepend extend
      \ containedin=ALLBUT,htmlComment

" kill the excessive whitespace on linebreaks, etc.
syn match htmlLinkWhite "\_s\{2,\}" contained containedin=htmlLink
hi default link htmlLinkWhite Ignore

The first bit folds all html tags that are defined to have a begin tag
<tag> and and end tag </tag>. It will also fold those whose end tags
are optional like <li> and <p> so be sure to use good practices and
close those off too, or your folding will be funky.

The second bit is not needed for your immediate problem, but it makes
it so that multi-character whitespace inside of links (by default
highlighted with an underline) do not get the underline along with the
rest of the link.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to