On May 25, 2012, at 3:08 PM, Chris Jones wrote: > On Tue, May 22, 2012 at 09:14:03AM EDT, Eric Weir wrote: > >>> On May 20, 2012, at 12:20 AM, Chris Jones wrote: >>> >>> What folding method are you using..? >> >> At first I didn't know how to answer. I didn't find anything related >> to fold method in my .vimrc. Fortunately, I keep copies of emails >> pertaining to problems I've encountered and solved with the help of >> people here and at vim_mac. Thank God! >> >> Turns out I'm using Vlad Irnov's markdown folding script. >> https://gist.github.com/1035030 I'd completely forgotten about it, but >> it is what takes care of it for me. > > I meant the value of the ‘foldmethod’ Vim option. What does ‘:set fdm?’ > tell you?
Thanks, Chris. It depends on the filetype. If it's markdown the result is "foldmethod=expr." Otherwise "foldmethod=manual." > 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. >> Maybe this is something Vlad overlooked? Whatever, the workaround is >> pretty simple, so thanks again for that. > > I use a one-line expression to fold Vim help files that is quite similar > to the script you referred me to and it updates the folding immediately > when for instance I duplicate the first couple of lines of an existing > fold by copying and pasting it - I never have to reload the file. > > At a glance I cannot see any particular reason why the above-mentioned > script shouldn't work the same. Not a programmer. Since the script controls folding on markdown files I would look to it for an explanation. My guess about what's going on when a script or plugin seems not to be working as it should is often completely wrong. > 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. Regards, ------------------------------------------------------------------------------------------ Eric Weir 1111 Clairemont Avenue J3 ~ Decatur, GA 30030 404-636-6142 ~ eew...@bellsouth.net -- 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