Great, many thanks. I hadn't got around to learning about the
"exec" type commands, buttinkering with this has helped. You
left out an end- bracket just before the final pipe, and it's
i=i+1 as the incremental statement, but your statement worked
pretty much as is, thanks.

Sorry I didn't test it, but it looks like you found the bugs. I'm sure you're all the smarter for it now, thanks to my pedagogical ways. :*)

I'm curious why the i+=1 didn't work for you...perhaps a pre-vim7 thing? Or a funky context for "let" that it got confused?

I just tried (using vim7 within a random help document)

        :let i=0 | g/\<the\>/let j+=1

and it worked, counting the lines with the word "the" on them.

Odd.

Also my vim capabilities didn't include the (i>25? 25 :i), so
I had some trouble learning about this syntax. It's sometimes
tricky to look up stuff like this in the help, as the term
under which to search can be any number of things: :help
conditional statements? :help abbreviated conditionals? :help
>? Generally I dont bother with help and just tinker, and find
out by trial an error. Though that's pretty inefficient.

Gracious, I didn't realize how hard that ternary operator was to find in the help unless you already knew where to look! It's the same as the C/C++/Java operator which is how most folks know to try and use it. It can be found in the help at

        :help expr1
        :help E109

but neither tag remotely hints at what the documentation there describes. Perhaps the help maintainers could stick in a tag for something like ":?" so it's somewhat more easily findable? I had to go through ":help eval.txt" and then use

        :g/:.*?/#

to find the hits. I suppose a ":helpgrep" would have done something similar.


-tim



Reply via email to