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

57 views
Skip to first unread message

markem

unread,
Nov 29, 2025, 1:27:50 AM11/29/25
to vim_use
I am writing a PHP script to allow me to modify everything in my environment variables. All I have gotten to so far was to do the Microsoft DOS command SET to get the list of environment variables. To my surprise I got the following:

    [51] => map_h=:map h :w<CR>:!cls<CR>:!C:\xampp\php/php %<CR>
    [52] => map_i=:map i :w<CR>:!cls<CR>:!C:\xampp\php/php -l %<CR>
    [53] => map_u=:map u :w<CR>:!cls<CR>:!C:\xampp\php/php % > out.dat<CR>

So I went "That's really weird. Maybe I did something wrong in my program." So I did a

:!set > out.dat

And in looking at the output file I found:

macos9_path=C:\Program_Files\MacOS9\Programs
mame_path=C:\Program_Files\Mame Gaming
map_h=:map h :w<CR>:!cls<CR>:!C:\xampp\php/php %<CR>
map_i=:map i :w<CR>:!cls<CR>:!C:\xampp\php/php -l %<CR>
map_u=:map u :w<CR>:!cls<CR>:!C:\xampp\php/php % > out.dat<CR>
mingw_path=C:\Program Files (x86)\MinGWStudio\MinGW\bin
MSDevDir=C:\Program Files (x86)\DSv5\SharedIDE

But when I tried to get rid of these map commands, I am told

ERROR: The system was unable to find the specified registry key or value.
ERROR: The system was unable to find the specified registry key or value.
ERROR: The system was unable to find the specified registry key or value.
Hit any key to close this window...

Now - I really do have those commands in my VIM script and they all work. The map_u command was how I just ran the PHP script. What I am wondering about is - how are they being generated. Is it something I'm doing in Vim itself? All I have is a map command:

:map <rest of the command>

So I thought this was rather strange. If anyone has ideas I'd like to hear them because this has me baffled.

Thanks in advance.

Mark

markem

unread,
Nov 29, 2025, 1:31:08 AM11/29/25
to vim_use
Sorry - I am running VIM v9.1 on Windows 10 system. If you need more info - let me know. Thanks.

Christian Brabandt

unread,
Nov 30, 2025, 4:48:13 AM11/30/25
to vim...@googlegroups.com

On Fr, 28 Nov 2025, markem wrote:

> I am writing a PHP script to allow me to modify everything in my environment variables. All I have gotten to so far was to do the Microsoft DOS command SET to get the list of environment variables. To my surprise I got the following:
>
>     [51] => map_h=:map h :w<CR>:!cls<CR>:!C:\xampp\php/php %<CR>
>     [52] => map_i=:map i :w<CR>:!cls<CR>:!C:\xampp\php/php -l %<CR>
>     [53] => map_u=:map u :w<CR>:!cls<CR>:!C:\xampp\php/php % > out.dat<CR>
>
> So I went "That's really weird. Maybe I did something wrong in my program." So I did a
>
> :!set > out.dat
>
> And in looking at the output file I found:
>
> macos9_path=C:\Program_Files\MacOS9\Programs
> mame_path=C:\Program_Files\Mame Gaming
> map_h=:map h :w<CR>:!cls<CR>:!C:\xampp\php/php %<CR>
> map_i=:map i :w<CR>:!cls<CR>:!C:\xampp\php/php -l %<CR>
> map_u=:map u :w<CR>:!cls<CR>:!C:\xampp\php/php % > out.dat<CR>
> mingw_path=C:\Program Files (x86)\MinGWStudio\MinGW\bin
> MSDevDir=C:\Program Files (x86)\DSv5\SharedIDE

So it seems you did define those in your environment, not inside vim.
Check Environment settings for your Windows operating system.

>
> But when I tried to get rid of these map commands, I am told

What exactly did you try? You should either use `:unlet $map_h` but this
will only unset those variables inside your Vim session, or using
set map_h=
in a cmd.com terminal window to remove it temporarily inside your
cmd.exe session.


Thanks,
Christian
--
Why does a ship carry cargo and a truck carry shipments?

markem

unread,
Dec 7, 2025, 8:33:15 PM12/7/25
to vim_use
No - I do not want to get rid of the commands. They are a part of my VIM Script when I edit a PHP file. After trying several things for a few hours all I can say is - is that for some reason, when I execute the PHP - these three commands just include themselves. Unknow why. Oh well, I'll just make sure to remove them from whatever information I get from doing an EXEC() command. I was mainly wondering if VIM makes temporary Windows variables.

Christian Brabandt

unread,
Dec 8, 2025, 10:24:18 AM12/8/25
to vim...@googlegroups.com

On So, 07 Dez 2025, markem wrote:

> No - I do not want to get rid of the commands. They are a part of my
> VIM Script when I edit a PHP file. After trying several things for a
> few hours all I can say is - is that for some reason, when I execute
> the PHP - these three commands just include themselves. Unknow why. Oh
> well, I'll just make sure to remove them
> from whatever information I get from doing an EXEC() command. I was
> mainly wondering if VIM makes temporary Windows variables.

It does so if you do :let $var=..., see :h :let-$

Thanks,


Thanks,
Christian
--
A Los Angeles judge ruled that "a citizen may snore with immunity in
his own home, even though he may be in possession of unusual and
exceptional ability in that particular field."

Mark Manning

unread,
Dec 9, 2025, 2:15:34 AM12/9/25
to vim...@googlegroups.com
Let me try that.
> --
> --
> 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+u...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/vim_use/aTbtb1qHo38hSXDu%40256bit.org.

Mark Manning

unread,
Dec 31, 2025, 4:01:03 AM (21 hours ago) 12/31/25
to vim...@googlegroups.com
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.)

Christian Brabandt

unread,
Dec 31, 2025, 5:31:23 AM (19 hours ago) 12/31/25
to vim...@googlegroups.com
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.

Mark Manning

unread,
Dec 31, 2025, 8:42:29 AM (16 hours ago) 12/31/25
to vim...@googlegroups.com
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


--
--
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+u...@googlegroups.com.

Mark Manning

unread,
Dec 31, 2025, 6:45:14 PM (6 hours ago) 12/31/25
to vim...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages