Monday, January 5, 2026

Re: decvers.vim

hello Mark,

On Fri, Jan 02, 2026 at 03:57:08PM -0600, Mark Manning wrote:
> Actually, I was just posting it so if anyone wanted it they could have
> it. As for using someone else's script - I just like mine.

if so, you should probably create a git repo outthere so people can
easily deploy, comment, contribute ...

> Thanks for > letting me know how you feel. :-)

I try to be as helpful as others was to me when providing me this kinds
of feedbacks. you're welcome.

regards

--
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
☎ 03.68.85.60.79

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/aVudy8pUCiDoyrDe%40prometheus.

Friday, January 2, 2026

Re: decvers.vim

Actually, I was just posting it so if anyone wanted it they could have
it. As for using someone else's script - I just like mine. Thanks for
letting me know how you feel. :-)

On Fri, Jan 2, 2026 at 7:04 AM Marc Chantreux <mc@unistra.fr> wrote:
>
> hello Mark,
>
> As you posted the whole script on the list, you probably expect some
> feedbacks so mine is:
>
> I script a lot of things and what I consider a good practice is the
> complete oposite of what you're trying to achieve here: If your code is
> useful, someone will probably want to use it out of vim so don't use
> viml and pick another scripting langage (zsh, dash, rc, tcl, perl, js,
> ruby, python, R, there are tons of those) then use it from vim using
> ! or system* functions.
>
> Also: take a look at vim9script: it it much more confortable than the
> old style vim langage.
>
> regards,
> Marc
>
>
> --
> Marc Chantreux
>
> --
> --
> 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/uz1SylyjsfQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/vim_use/aVfCMhJyywsFvJNM%40prometheus.

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAPJLamx-OupBP2j6Agw60ueZbfRRi4m00iG6d-Qez8Ss%3DksDYQ%40mail.gmail.com.

Re: decvers.vim

hello Mark,

As you posted the whole script on the list, you probably expect some
feedbacks so mine is:

I script a lot of things and what I consider a good practice is the
complete oposite of what you're trying to achieve here: If your code is
useful, someone will probably want to use it out of vim so don't use
viml and pick another scripting langage (zsh, dash, rc, tcl, perl, js,
ruby, python, R, there are tons of those) then use it from vim using
! or system* functions.

Also: take a look at vim9script: it it much more confortable than the
old style vim langage.

regards,
Marc


--
Marc Chantreux

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/aVfCMhJyywsFvJNM%40prometheus.

Thursday, January 1, 2026

decvers.vim

First, sorry for top posting. I was just replying to my email. Live and learn as they say. Now I know to not do that. I'll try to always go to the list and post there from now on. Again - very sorry.

I decided to post my decvers.vim script here in case anyone out there would like to use it. Why is it called decvers.vim? The "dec" part comes from the Digital Equipment Corporation or DEC name. The "vers" is for the word "version". Thus decvers.vim.

What it does is to make a copy of your source code automatically. It does this by adding a semicolon (;) to the end of the file name and then adding a five digit number to the end of the file name also. (So like "00000" or "00001" and so on.) Each time you edit the file, it adds one new number onto the end of the save (I have it set to do this three times). When you reach the maximum number of saves the earliest version is removed. Thus, you don't over run your system with backup copies. The interesting thing about this is that this shows you how you could do an automated version number in the program but I'm just interested in just having a backup I can return to if somehow I manage to muck up the current version. Anyway, here is the code. It is not perfect but it works. :-)

decvers.vim
" Note that tab stops should be at 4 spaces. Also I left all of my ECHO commands
" in - in case anyone wants to play around with the script. This is free software and
" can be used anywhere for anything. It is basically public domain. MEM.

Beginning of script

" -*- vim -*-
" @(#) $Id: decvers.vim,v 0.1 Mark Manning
"
" Notes: Please note that I am using five zeros as the size of the
" backup file names. So we have 00000 and then 00001, 00002, etc...
"
let path_name=expand("%:p")
let file_name=expand("%:t")
"
" Now see about getting all of the iterations of the current file
"
let cmd ='dir /b/on "' . path_name . ';*"'
let x=systemlist(cmd)
" let x=split(x[0],"\n")
let ary_len=len(x)

" echo "CMD = " . cmd
" echo "X = "
" echo x
"
" Now get the highest number of the iterations
"
let l=0
let high_num=0
if( ary_len > 0 )
while( l < ary_len )
let a=split(x[l],";")
" echo "A = "
" echo a
let a_len = len(a) - 1
let a_last = a[a_len]
" echo "a_last = " . a_last
if( a_last >= high_num )
"
" For unknown reasons a_last is never higher than high_num
"
" echo "a_last = " . a_last
let high_num = str2nr( a_last, 10 )
" echo "High_num = " . high_num
else
" echo "a_last = " . a_last
let high_num = str2nr( a_last, 10 )
" echo "High_num = " . high_num
endif

" echo "L = " . l
let l += 1
endwhile
endif
"
" 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

let cmd = 'copy "' . path_name . '" "' . new_path . '"'

let output = systemlist( cmd )

" echo "CMD = " . cmd
" echo "Output = "
" echo output
"
" Now get rid of any extra backup files we might have. MAX_BACKUPS is set here.
"
let max_backups = 3
"
" Now do the above again to get all of the backup files
"
let cmd ='dir /b/on "' . path_name . ';*"'
let x=systemlist(cmd)
" let x=split(x[0],"\n")
let ary_len = len(x)

" echo "CMD = " . cmd
" echo "X = "
" echo x
"
" If the ary_len is greater than max_backups - get rid of
" the lowest numbers because those are the oldest.
"
if( ary_len > max_backups )
let l=0
let ary_len = ary_len - max_backups
if( ary_len > 0 )
while( l < ary_len )
let a=split(x[l],";")
" echo "A = "
" echo a
let a_len = len(a) - 1
let ext = a[a_len]
let file_name = expand("%:p") . ";" . ext
let cmd = 'del "' . file_name . '"'
let output = systemlist( cmd )

" echo "CMD = " . cmd
" echo "Output = "
" echo output
" echo "L = " . l

let l += 1
endwhile
endif
endif

finish

End of Script

Have fun with it!

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/b8b1a020-dbcd-48bd-9350-348eb66b068an%40googlegroups.com.

Re: Q&A: MSDOS SET command gave me some of my mapped commands

Please do not top poste.

On Mi, 31 Dez 2025, Mark Manning wrote:

> 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.)

I am afraid that ship has sailed long ago.

> 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.
> :-)

:h expr-number

Thanks,
Christian
--
Ingrate, n.:
A man who bites the hand that feeds him, and then complains of
indigestion.

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/aVaKtE78zPujCmAi%40256bit.org.

Wednesday, December 31, 2025

Re: Q&A: MSDOS SET command gave me some of my mapped commands

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
<mark.eugene.manning@gmail.com> 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 <cblists@256bit.org> 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 vim_use+unsubscribe@googlegroups.com.
>> 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 vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAPJLamywWdB8hpOr_zi3x%3DYuL1efULZ_g3jSunxMsvvDELCnpg%40mail.gmail.com.

Re: Q&A: MSDOS SET command gave me some of my mapped commands

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 <cblists@256bit.org> 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 vim_use+unsubscribe@googlegroups.com.
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAPJLamyekZagPxLQ5Su2TGBNKehe2%3DwGapn%3DpjxFncVxWS7Fsw%40mail.gmail.com.