Reputation: 151
I have vim to add headers to my files and I want to change the minor version number automatically each time I do :w
to save the file. The header line is like this:
# Version : 0.0.24
and I know I need to add something like this
autocmd Bufwritepre,filewritepre *.* exe "1,". 10 . "g/Version ???<C-a>
to my .vimrc file. However, I can't get it right. Can someone help me out?
Thanks in advance,
Upvotes: 3
Views: 234
Reputation: 195209
.... g/Version/norm! $^A``
this cmd will increment the number, and keep the cursor position.
the ^A
you press C-V C-A
you also could turn to :s/.../\=.../
to increment the minor version part.
Upvotes: 4