Summary:

    By default, :cn should open a closed fold, and when executed as 
    ":cn", it does so.  But when :cn is the rhs of a map and the lhs 
    of the map is typed, closed folds do not open.  I think :cn 
    should behave the same whether executed directly or as part of a 
    map.

    This behavior is the same in Vim-7.0 and Vim-6.4.  I just 
    noticed it now because I'm starting to work with some file types 
    that open with folds initially closed.  The behavior is also the 
    same in vim built for SunOS 5.8 and in gvim on Windows XP.

Replication Instructions:

    1.  Create the following test file, mary.

        ----------------------- cut here -----------------------
        Mary had a little lamb,
        Its fleece was white as snow,
        And everywhere that Mary went,
        The lamb was sure to go.

        It followed her to school one day,
        Which was against the rule,
        And made the children laugh and play
        To see a lamb at school.
        ----------------------- cut here -----------------------

    2.  Start vim in the same directory as mary.

            vim -N -u NONE

    3.  Execute the following vim commands.

            map <C-N> :cn<CR>
            set foldmethod=expr
            set foldexpr=getline(v:lnum)!~'^$'
            grep lamb mary

        The foldexpr makes each paragraph a fold.

    4.  The file opens with the first paragraph/fold open and the 
        second paragraph/fold closed, as it should.

    5.  Type <C-N> twice.  The second paragraph/fold remains closed.  
        I believe this is a bug.

    6.  Execute

            :cp
            :cn

        The second paragraph/fold is now opened, as it should be.

Gary

-- 
Gary Johnson                 | Agilent Technologies
[EMAIL PROTECTED]     | Wireless Division
                             | Spokane, Washington, USA

Reply via email to