I want to generate sequential file names that take the last 2+ digits
from current buffer's name and count upwards from there. Like this:
08a01 > 08a02 > 08a03 > ...
.
The snippet I use (thanks for initial advice, Ingo Karkat!) leaves out the zeros,
producing sequences like 08a01 > 08a2 > 08a3 > ...
.
if b:current_buffer_name =~ '\d\+$'
let lastDigit = matchstr(b:current_buffer_name, '\d\+$')
let newDigit = lastDigit + 1
let s:new_file_name = substitute(b:current_buffer_name, '\d\+$', newDigit, '')
else
let s:new_file_name = b:current_buffer_name . '01'
How can I tell Vim in a function that it should count upwards "with
zeros"? I tried adding let &nrformats-=octal
before the
if-condition (as suggested here), but that didn't work.
Thanks for any explanations!