> On Sun, Nov 28, 2010 at 11:05 PM, Benjamin R. Haskell wrote:
>
>>
>> You want foldmethod=syntax, not foldmethod=indent.
>>
>> 'indent' folds based on how far a given line is indented. 'syntax'
>> folds based on syntax rules specific to the filetype being edited.
>>
>> 'indent' is really only useful (IMO) when you're editing something
>> very, very simple that doesn't have a proper Vim 'syntax' set up.
>> Anything else usually has good defaults for folding via 'syntax' (or
>> is configurable to do so).
>>
>>
> Ok thanks. I had tried that but didn't have any luck. Kept saying "no
> fold found" when I swtiched to foldmethod=syntax. I'll have to go back
> and slowly build up a valid .vimrc that works.
>
> Question: Ultimatley I want code folding in html files (and preferebly
> later haml/erb) should using foldmethod=sytnax work for any file that
> it recognizes the syntax?
Not universally, no. In terms of handling things other than
highlighting, the syntax files vary a bit in quality. Similar to the
way Wikipedia articles vary in quality, the best syntax files are the
ones that either: 1) the most people care about, or 2) someone goes out
of their way to improve. Often the original author of the file might
just be unaware of folding, so it gets omitted.
Since you mentioned it explicitly, the eruby filetype seems to lack
folding. I don't have any 'haml' files sitting around for testing (had
some old Ruby on Rails stuff for .rhtml files), but its syntax file is
by the same author, and also doesn't mention folding at all.
--
Best,
Ben
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment