I love to work with Vim. I use the autocmd in ~.vimrc like:
:fun LastMod()
: if line("$") > 20
: let l = 20
: else
: let l = line("$")
: endif
: exe "1," . l . "g/Last modified: /s/Last modified: .*/Last modified: " .
: \ strftime("%Y %b %d")
:endfun
The Question is: How can I add or/and modify a version-number like:
from Version: v1.345 to Version: v1.346
In action when I write a shell-Script, I like to automaticly modify some Lines:
#!/bin/bash
# Last modified: <date time>
# Version: v1.23-<n>
#
(maybe thats a little more clear)
what I mean is: in a script like: #!/bin/bash # Last modified: # Version: v1.23<#>
I think you want to change the version in your shell script(s). Assume that you have:
#!/bin/bash
#Last modified: whatever
#Version: v1.234
#other stuff
...
You can have this line in your .vimrc
:
let @v="gg/Version:/\<cr>2E\<c-a>"
Then everytime you open your shellscript, pressing @v
will make the version number be incremented by 1. Well the 1
means for example, from v1.1099
to v1.1100
In fact it created a macro.