Sunday, November 28, 2010

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

To simplify it even more, I backed up my ~/.vim dir and put barely anything in my .vimrc. Then I created this xml:

<test>
        <level-one>
                <name>Foo</name>
                <name>Boo</name>
                <level-two>
                        <something>A</something>
                        <something>B</something>
                </level-two>
        </level-one>
        <level-one>
                <name>C</name>
                <name>D</name>
        </level-one>
</test>

Now if my cursor is in the first <level-one> tag, and I do zc or even za, I'd expect JUST that fist level-one node to collapse, instead EVERYTHING collapses so that it looks like:

<test>
+-- 12 lines: <level-one>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</test>
 
If I then go to expand the node above it's as if it had collapsed all level-one nodes:

<test>
        <level-one>
+---  6 lines: <name>Foo</name>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        </level-one>
        <level-one>
+---  2 lines: <name>C</name>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        </level-one>
</test>

Why is this? How do I get the typical folding that I'm used to in other editors/ides? I want the behavior where you can just collapse single nodes.

Thanks for any help in getting to the bottom of this.


On Sat, Nov 27, 2010 at 4:28 PM, Rick R <rickcr@gmail.com> 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

I tried set foldlevel=1 also

 



--
Rick R

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