Sunday, November 28, 2010

Re: major confusion on vim folding behavior I'm seeing

On Sat, 27 Nov 2010, Rick R wrote:

> I'm trying to get vim folding to behave as I'd expect. I changed it to
> 'indent' (since it wasn't picking up html files for some reason with
> 'syntax' as the folding type.)
> Here is a valid xml file indented properly (just a snippet shown):
>
> http://img.skitch.com/20101127-qe6x55rbfrp1xg14dhhqi3h12d.jpg
>
> Now if I put my cursor in the node "distributionManagement" I'd expect
> it to collapse that node (using zc),  Instead it collapses a bunch of
> junk and looks like:
>
> http://img.skitch.com/20101127-qk79fh5k73ash2xpmdeiry2421.jpg
>
> I really have no idea what's going on. It seems to just do very random
> stuff when I mess around with collapsing and expanding nodes. I read
> the help file and I thought I grasped the concepts, but apparently not
> or else I have something set up wrong.
>
> my .vimrc has:
>
> set foldmethod=indent
> set nofoldenable        "dont fold by default
> set foldlevel=0

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).

--
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: