Friday, December 2, 2011

Re: How to fold by expression using a function?

Ben,
I followed your suggestions (not sure if I understand it all).  But I
still get the "E490: No fold found" message. Here is what I did:
Moved the markdown.vim file from ftplugin folder to the indent folder.
Added these lines to top of markdown.vim file:
setlocal foldmethod=expr
setlocal foldexpr=Foldexpr_markdown(v:lnum)
I saved the files and then reopened test_fold.txt file, but got "E490:
No fold found" message when zc from lines starting with "#":
## test level 2
Thank you for your help.
wolfv

On Dec 2, 8:57 am, Ben Fritz <fritzophre...@gmail.com> wrote:
> On Dec 2, 9:37 am, wolfv <wolfvo...@gmail.com> wrote:
>
> > Thanks Christian.  Those fixes stopped Vim from complaining on
> > startup.  But now I get a "E490: No fold found" message.  What did I
> > do wrong?
> > I saved the Foldexpr_markdown function in:
> >         C:\Program Files (x86)\Vim\vimfiles\ftplugin\markdown.vim
> > Is that the right location?
>
> > I changed the _vimrc lines to:  set foldmethod=expr     set
> > foldexpr=Foldexpr_markdown(v:lnum)also tried "setlocal" in _vimrc:
> > setlocal foldmethod=expr        setlocal
> > foldexpr=Foldexpr_markdown(v:lnum)but either way, I got "E490: No fold
> > found" message when zc from lines starting with "#":      ## test level 2
>
> Here's what you should have:
>
> _vimrc:
> filetype plugin indent on
> OR
> filetype indent on
>
> C:\Program Files (x86)\Vim\vimfiles\ftplugin\markdown.vim: irrelevant
>
> C:\Program Files (x86)\Vim\vimfiles\indent\markdown.vim:
> (normal setup for an indent plugin, see a file chosen at random from
> $VIMRUNTIME/indent)
> (definition of Foldexpr_markdown)
> setlocal foldmethod=expr
> setlocal foldexpr=Foldexpr_markdown(v:lnum)
>
> NOTE: a better place than C:\Program Files (x86)\Vim\vimfiles, is $HOME
> \vimfiles. $HOME defaults to %HOMEDRIVE%%HOMEPATH% on Windows, but the
> easiest way to see where it is, is to type from within Vim,
> :echo $HOME
>
> The same goes for the _vimrc.

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