Saturday, May 26, 2012

Re: Folding on markdown headers

On May 25, 2012, at 10:12 PM, Chris Jones wrote:

>> On Fri, May 25, 2012 at 06:35:28PM EDT, Eric Weir wrote:
>>
>> Thanks, Chris. It depends on the filetype. If it's markdown the result
>> is "foldmethod=expr." Otherwise "foldmethod=manual."
>
> So it looks like the markdown script gets loaded when dealing with
> a markdown file. I should have asked you to issue a ':verbose set fdm'.
>
> When in a markdown file, it gives "foldmethod=expr Last set from ~/.vim/after/ftplugin/markdown.vim"
>
>> There are two types of markdown headers, Setext and atx. Setext uses
>> equal sign or single underline underlining. atx uses hashmarks, #, ##,
>> etc. I use the latter and the script folds on them fine.
>
> OK. I wrongly assumed the hash marks introduced comments. Doesn't make
> any difference, though. I have a feeling that the problem is that the
> folding script is not executed when you create markdown files, only when
> you read them.
>
>> Maybe this is something Vlad overlooked? Whatever, the workaround
>> is pretty simple, so thanks again for that.
>
> Looks more like something is missing. I don't see markdown in the global
> file type detection file (filetype.vim) but I'm running Vim 7.2. Now the
> script only does folding.

Thanks, Chris. I don't find that file in my .vim folder. I have Vim 7.3 [MacVim]. I don't know when it became effective, but my understanding is that markdown support is built into Vim. I thought I was getting folding and highlighting on regular markdown files, i.e., "md," but when I checked just now it appears that I am not. So I put the auto command you suggested in your previous response in my .vimrc. Then I get folding and highlighting, but only when opening a previously saved file.

> Did you download a syntax highlighting file
> from somewhere else? Do you have any other 'markdown.vim' files on your
> system? Seems there are 2-3 different syntax files lying around in
> different repos (vim.org, github..).

Again, I was under the impression that markdown support is now built in to Vim. Perhaps I am mistaken about that. I'll have to look into what syntax files are on my system. I don't believe I've added any to my Vim installation. Some [all?] of my plugins may have their own syntax files. I'm pretty sure one---VimWiki---does and it sets a fold method ['expr"], but only for VimWiki files. I'll check for others.

Regards,
------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA
eeweir@bellsouth.net

"A writer is a person for whom writing is more difficult
than it is for other people."

- Thomas Mann






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