On Fri, May 25, 2012 at 06:35:28PM EDT, Eric Weir wrote: > > On May 25, 2012, at 3:08 PM, Chris Jones 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’. > > The script sets the fdm option to ‘expr’ for the current buffer/window, > > which amounts to running user-written code for each line in the buffer. > > > > In this particular case, the user-written code is a function named > > ‘Foldexpr_markdown()’. By the look of it, this function should create > > a fold automatically wherever it sees a line that starts with an equal > > sign in column one, followed by either an equal sign or white space. > > A valid markdown header would be something such as ‘= a header’.. or > > ‘=== another header’... etc. > > > > So that if you if you add a line of the form: ‘= this is a header’ and > > hit <Enter>, the script should run automatically and create a fold > > immediately. At least that's the way I understand it. > 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. 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..). [..] > > What exactly do you mean by ‘when I create a file’..? How does it ‘not > > work’? > I start with an empty window, i.e., no file loaded. I type in a "#" > and some text, do a <CR> and some more text, another <CR> and some > more text, then write/save the file as a markdown file, i.e., with > markdown extent. At that point the header is not highlighted and > folding does not work. If I close the file and reopen it, highlighting > and folding work. I _believe_ this is usually done via autocommands. See my other post. CJ -- WE GET SIGNAL -- 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