Hi,
Found a macro (written by VIm guru Benji FIsher) that does the below, but I
cant seem to get it to work in my .vimrc. Do I need to use exec or normal to
run this substitution? I want to put it in an exisiting function that is
called whenever a certain filetype is written (C, Perl, Java, etc). BTW,
I've just moved to Vim 6 (as of 10 minutes ago :-)) so if you have a version
6 -specific method, thats OK
Cheers
Rory
:s/\(version.*\)\(\d\{2,3}\)/\=submatch(1).(1+submatch(2))/
> -----Original Message-----
> From: Rory Winston
> Sent: 19 July 2001 10:54
> To: 'ilug at linux.ie'
> Subject: Vim macro for autoincrementing an integer
>>> Hi,
>> I am looking for a function/macro that will take a line such as :
>> Revision: 1
>> or
>> Revision: 1.00
>> and increment it, so the first line would become "2", the
> last line would become "1.01". I found some similar macros on
> the Web, none of which I can get to work the way I want them
> to. I want this to be executed whenever a file is written (or
> possibly even when I run :make on a source file). Does
> anybody have anything like this done already? I am using Vim
> 5.8 on Win32
>> Cheers
>> Rory
>> --------------------------------------------
> Rory Winston,
> Developer,
> OneLine Team,
> TeleWest Communications,
> Genesis Business Park,
> Albert Drive,
> Woking Surrey,
> GU21 5RW
>> mailto: rory.winston at telewest.co.uk> phone: 01483 295 653
>
------------------------------------------------------------------------------
Live Life in Broadband
www.telewest.co.uk
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material.
Statements and opinions expressed in this e-mail may not represent those of the company. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender immediately and delete the material from any computer.
==============================================================================
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!