Hi Tim, 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.
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. Enough rambling. Many thanks again. ----- Original Message ---- From: Tim Chase <[EMAIL PROTECTED]> To: o1792 <[EMAIL PROTECTED]> Cc: vim@vim.org Sent: Tuesday, 9 January, 2007 3:54:12 PM Subject: Re: how to auto set all 26 markers when a match is made? > But what I'd like to is have vim put in the markers itself, > based on a regex I give it. So I suppose I need some sort of > exec command the kind used in unix find, etc. i.e. > > :%s/myfabregex/exec "ma"/g > > of course that will only work for the first marker, so I will > need a loop that increments alphabetically, which I also don't > know how to do (numerically, yes) > > Would that be possible? The idea is that I could navigate long > documents using the markers. Yes it's possible (I presume you mean "norm" rather than "exec" as "exec" gets you the ex command, while "norm" gives you the normal command)...though you'd have to define what sort of behavior you want if there are more than 26 hits for your regexp in the document. The basic "command" (okay, it several commands that could be mapped as one) would be something like this untested: :let i=0 | g/re/exec "k".nr2char(97+(i>25? 25 : i) | let i+=1 The behavior here is that if you have more than 26 matches, the first 25 are tagged, and then the 26th marks the last hit, so 26..N-1 are unmarked. Tinker to taste. -tim ___________________________________________________________ Inbox full of unwanted email? Get leading protection and 1GB storage with All New Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html