Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

How do i enable heading folds?

Viki
dpar
2010-09-13
2013-04-17
  • dpar
    dpar
    2010-09-13

    Hi, I set up viki and added the following to my .vimrc

    au BufRead,BufNewFile *.viki set ft=viki
    let g:vikiFolds = 'hHl'
    let g:vikiFoldMethodVersion = 7
    

    When I open a .viki file with headings (* Heading1, ** Subheading, etc..) and press "zc" to fold headings (tried both inside the heading itself and in text under the heading), i get "E490: No fold found".

    I'm kind of a vim newbie but I've had a peek at the code and the "^\*\+" regex does find the headings in my .viki files. What am i missing?

    Thank you,
    -Dmitriy

     
  • Tom Link
    Tom Link
    2010-09-13

    If the buffer looks like this:

    ---BEGIN---
    * Foo

    ** Bar
    ---END---

    Then typing /^\*\+<cr> where <cr> is the enter button, doesn't match anything?

    What is the value of magic:

    :echo &magic

     
  • dpar
    dpar
    2010-09-13

    /^\*\+ matches * in line 1 and ** in line 3

    :echo &magic returns 1

    BTW: ":echo &foldmethod" returns "manual"  and ":echo &foldexpr" returns 0
    Shouldn't it be "expr" and 1 or 2 depending on where in the example buffer i am?

    Thank you,
    - Dmitriy

     
  • Tom Link
    Tom Link
    2010-09-13

    ftplugin/viki sets these options:

    setlocal foldexpr=VikiFoldLevel(v:lnum)
    setlocal foldtext=VikiFoldText()

    You could try
    :verb set foldexpr
    to find out where foldexpr was set.

    Regards,
    Tom

     
  • dpar
    dpar
    2010-09-13

    Ah, it was a PEBCAK issue. I didn't read the requirements carefully and forgot to add

    set nocompatible
    filetype plugin indent on
    syntax on
    

    to my .vimrc

    Folding works after i added that.

    Thank you for your help. Great plugin!
    -Dmitriy