One last message. Plus zero did not work. Yes, it is acting as if it were octal. Vim should not really do that as sometimes people do put zeros in front of the number. (At least, this old fogey remembers when people used to do that all of the time.) Here is what works:
str2nr( $value, $type ) So I used str2nr( $ext, 10 ) And that forced it to keep the number as 10. Just thinking aloud here but it would be nice to have 0b for binary, 0c for octal, 0x for hexadecimal, and 0d for decimal. But I guess no one wants to do that. :-) Mark On Wed, Dec 31, 2025 at 7:42 AM Mark Manning <[email protected]> wrote: > > Ugh. Should have thought of that. I thought up a solution wfile I slept. > Number gotten off of a filenamfe. So a plus zero when I get it should work > Thanks again. > > Mark > > > On Wed, Dec 31, 2025, 4:31 AM Christian Brabandt <[email protected]> wrote: >> >> >> On Mi, 31 Dez 2025, Mark Manning wrote: >> >> > Hi again Christian! >> > >> > I am back with another wierdo problem. >> > >> > Here is the code: >> > >> > " >> > " Make a new filename (ie: full file name PLUS .(high_num+1) >> > " In other words - make a new filename with the backup number one >> > " higher than the highest backup number. Example A.BOB;00001 >> > " >> > echo "High_num = " . high_num >> > let high_num = high_num + 1 >> > echo "High_num = " . high_num >> > let ext = printf("%05d", high_num ) >> > echo "High_num = " . high_num >> > echo "ext = " . ext >> > let new_path = expand("%:p") . ";" . ext >> > " >> > " Now save the file to the new file name we just made. >> > " >> > echo "new_path = " . new_path >> > >> > And here is the output (I haven't included all of the output - only >> > from this point). >> > >> > High_num = 00010 >> > High_num = 9 >> > High_num = 9 >> > ext = 00009 >> > new_path = D:\My Programs\PHP\Fix Paper Types\fixpapers. >> > php;00009 >> > >> > As you can see, "High_num" is originally set to "00010". (Actual >> > variable name is "high_num".) Anyway, I add one to that number and Vim >> > changes the number to "9". I have tried using: >> > >> > let high_num += 1 >> > and >> > let ++high_num <---Got an error doing this >> > and >> > let high_num++ <---Got an error doing this too >> > and >> > let high_num = high_num + 1 >> > >> > and I just keep getting that high_num has decremented by one. I'm using >> > version 9.1. Should I upgrade to a higher version of Vim? Thanks ahead >> > of time for responsing. I is after 2:00am here so I've got to go to >> > bed. Been working on this all day trying anything I could think of. >> > >> > Mark >> > PS: If you want the source code I can zip it up and send it. Simple >> > script called decvers.vim. (DEC VERSion - probably should rename it >> > to something like Upgrade_version.vim or maybe Make_backup.vim. I'm >> > basing it on the old DEC 11/780 system where every time you edited a >> > file it made a backup of the file and add the next higher number >> > to the end as ";#####". Earlier version numbers are older >> > than the bigger version numbers.) >> >> You can include the script verbose on the list, don't need to send it to >> me. So the whole list audience has a chance to chime in. >> >> My guess is the value is seen as octal, and therefore Vim is increments >> it in octal mode (00010 -> 8 decimal). >> >> Instead of incrementing a string value, I'd recommend to perform the >> actual arithmetics using a decimal number and then use printf() to >> convert it into a string value. >> >> Thanks, >> Christian >> -- >> The people rule. >> >> -- >> -- >> You received this message from the "vim_use" maillist. >> Do not top-post! Type your reply below the text you are replying to. >> For more information, visit http://www.vim.org/maillist.php >> >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "vim_use" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/vim_use/VAd-XX1KMOU/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To view this discussion visit >> https://groups.google.com/d/msgid/vim_use/aVT7N2dFqNeLPaAr%40256bit.org. -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAPJLamywWdB8hpOr_zi3x%3DYuL1efULZ_g3jSunxMsvvDELCnpg%40mail.gmail.com.
