On Mon, Apr 23, 2012 at 05:12:22PM EDT, Christian Brabandt wrote: > Hi Chris! > > On So, 22 Apr 2012, Chris Jones wrote: > > > On Sun, Apr 22, 2012 at 07:47:19AM EDT, Christian Brabandt wrote: > > > > > Hi Chris! > > > > Hallo Christian, wie geht's..? > > Ich bin beeindruckt ;)
Don't.. that's about all the German I can remember ;-) Since all your posts start with ‘Hi+name+!’ I was beginning to wonder if you had set up a bot to handle your mail. [..] > > The difficulty with fdm=syntax is that there is no explicit ‘end of > > section marker’ in my free-form, but nonetheless fairly ‘standard’ > > files and as often with Vim, it looks like folding was mostly > > designed to work with stuff like C code in mind.. Here, > > unfortunagely, the end of the current section is also the start of > > the next one. > The advantage of making an syntax script is, that you get syntax > coloring for free, although, this method is probably the most complex > one. If you could outline your file structure more explicitly, we can > probably design a syntax script for you. Hmm... I find it much easier writing a script/function even with my extremely superficial knowledge of Vim's scripting language. The downside is that when you start scripting everything you'd like to customize, you quickly end up with heaps of little bits and pieces of executable code, some of which you don't even remember are there (and often did not fully understand when you wrote them).. and it becomes harder and harder to stay on top of things. These days I tend to always prefer looking first into what I'd call static customization (I guess you could also call it native) such as provided in this instance by syntax folding. The trouble is that syntax folding requires a very good understanding of the way Vim processes syntax statements. And unfortunately what with the highlighting & folding being bundled together, I found the doc didn't help much. And there doesn't seem to be any introductory material in the form of vimtips & wiki articles available anywhere. [..] > > Now, as to the fold expression you suggest: > > > > . I'm not sure I understand why I need a getline(), since ‘:h fde’ > > states that the expression ‘is evaluated for each line to obtain its > > fold level’. I thought this meant that Vim would take care of the > > matching against the entire file? > The expression is evaluated for each line. That doesn't mean the > content of each line is compared with regard to the fold-expression. Indeed there was nothing wrong with your foldexpr.. [..] > > I won't have the time to take the regex apart & test it until later > > tonight and find out why it's not matching anything against my > > sample file, even when I use it as a search pattern from the command > > line, magic or nomagic.. Could the double backslashes have something > > to do with it..? > Yes, it's a side effect of using set. This means, the expression is > parsed twice and so the backslashes need to be doubled. In general, it > is usually better and more readable to use :let-expressions (:h :let-&), > but this was just a small one-liner. If such an expression get's more > complicated, it is also better to make an extra function out of it. My problem had nothing to with the foldexpre per se... I eventually found that for some reason, it didn't stick: at some point after checking everything & I couldn't understand why it didn't work, I did a ‘:set fde?’ immediately after manually setting it.. and the result was ‘foldexpr=’.. not even ‘foldexpr=0’, which is the usual default when it isn't set. Likely caused by remnants of my experiments with fdm=syntax getting in the way, because everything worked as it should after starting over with a clean testing environment. I'm grateful for the help - actually I believe it was you among others who provided me with an expression that folds Vim's help files automatically.. a couple years back, IIRC.. so I could have used that as a starting point if I had chosen to go down the fold expression path.. But I'd be a lot more interested in coining a ‘syn region.. fold’ statement that does the same thing, if only to learn something about syntax folding. Unfortunately, there are not many syntax files that implement folding and I can't think of a language (apart from html, maybe) where the end of a region is implicit - one region ends where another region at the same foldlevel starts. Thanks, CJ -- Hi! My name is bobby... -- 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
