Windows NT/95 Version


The Win32 version was created by George V. Reilly. The original Windows NT port was done by Roger Knobbe.

The Win32 version of Vim works on both Windows NT and Windows 95.

Compiles with Microsoft Visual C++ 2.0 compiler and later and NT 3.5 SDK.

This file contains the particularities for the Win32 version of Vim.

You can set the color used in five modes with nine termcap options. Which of the five modes is used for which action depends on the 'highlight' ('hl') option.

":set t_mr=^V^[\|xxm"		start of invert mode
":set t_md=^V^[\|xxm"		start of bold mode
":set t_me=^V^[\|xxm"		back to normal text

":set t_so=^V^[\|xxm" start of standout mode ":set t_se=^V^[\|xxm" back to normal text

":set t_us=^V^[\|xxm" start of underline mode ":set t_ue=^V^[\|xxm" back to normal text

":set t_ZH=^V^[\|xxm" start of italics mode ":set t_ZR=^V^[\|xxm" back to normal text

^V is CTRL-V ^[ is ESC xx must be replaced by a decimal code: The foreground color number and background color number added together:

COLOR FOREGROUND BACKGROUND
black 0 0
blue 1 16
green 2 32
cyan 3 48
red 4 64
magenta 5 80
brown 6 96
lighgray 7 112
darkgray 8 128
lightblue 9 144
lightgreen 10 160
lighcyan 11 176
lightred 12 192
lightmagenta 13 208
yellow 14 224
white 15 240
When you use 0, the color is reset to the one used when you started Vim. This is the default for t_tp. The default for t_ti is black on grey, 0 + 112 = 112. The default for t_tb is white on cyan, 15 + 48 = 63. The default for t_so is white on blue, 15 + 16 = 31. These colors where choosen, because they also look good when using an inverted display. But you can change them as you like.

If the "tx" (textmode) option is set (which is the default), Vim will accept a single <NL> or a <CR><NL> pair for end-of-line. When writing a file Vim will use <CR><NL>. Thus if you edit a file and write it, <NL> is replaced with <CR><NL>. If the "tx" option is not set the single <NL> will be used for end-of-line. A <CR> will be shown as ^M. You can use Vim to replace <NL> with <CR><NL> by reading in any mode and writing in text mode. You can use Vim to replace <CR<<NL< with <NL< by reading in text mode and writing in non-text mode. 'textmode' is set automatically when 'textauto' is on (which is the default), so you don't really have to worry about what you are doing.

Using backslashes in file names can be a problem. Vi halves the number of backslashes for some commands. Vim is a bit more tolerant, backslashes are not removed from a file name, ":e c:\foo\bar" works as expected. But when a backslash is used before a special character (space, comma, backslash, etc.) it is removed. Use slashes to avoid problems: ":e c:/foo/bar" works fine. Vim will replace the slashes with backslashes internally, to avoid problems with some MS-DOS programs.

If you want to edit a script file or a binary file you should reset the 'textmode' and 'textauto' options before loading the file. Script files contain single <NL> characters which would be replaced with <CR><NL>. You can do this by starting Vim with the "-b" (binary) option.

You should set the environment variable "VIM" to the directory where the Vim documentation files are. If "VIM" is used but not defined, "HOME" is tried too.

The default help filename is "$VIM\vim_help.txt". If the environment variable $VIM is not defined or the file is not found, the DOS search path is used to search for the file "vim_help.txt". If you do not want to put "vim_help.txt" in your search path, use the command ":set helpfile=pathname" to tell Vim where the help file is.

The ":cd" command recognizes the drive specifier and changes the current drive. Use ":cd c:" to make drive C the active drive. Use ":cd d:\dos" to go to the directory "dos" in the root of drive D. UNC names are also recognized; e.g., ":cd \\server\share\dir".

The files "_vimrc" and "_exrc" are used instead of ".vimrc" and ".exrc". The files "$VIM\_vimrc" and "$VIM\_exrc" are used instead of "s:.vimrc" and "s:.exrc". To use the file "c:\_vimrc" use the command "set vim=c:".

Use CTRL-break instead of CTRL-C to interrupt searches. The CTRL-C is not detected until a key is read.

Use CTRL-arrow-left and CTRL-arrow-right instead of SHIFT-arrow-left and SHIFT-arrow-right. The arrow-up and arrow-down cannot be used with SHIFT or CTRL.

Temporary files (for filtering) are put in the current directory.

The default for the sh (shell) option is "command.com" on Windows 95 and "cmd.exe" on Windows NT. If SHELL is defined it is used instead, and if SHELL is not defined, but COMSPEC is, that is used. External commands are started with "command /c <command_name>". Typing CTRL-Z starts a new command shell. Return to Vim with "exit".

The Win32 binary was compiled with Visual C++ version 4.0, using Makefile.w32. Other compilers should also work. If you get all kinds of strange error messages when compiling, you have to add <CR> characters at the end of each line. This can be done with the addcr program: "make addcr". This will compile addcr.c to addcr.exe and execute the addcr.bat file. Sometimes this fails. Then execute the addcr.bat file from the DOS prompt.

A swap file is used to store most of the text. You should be able to edit very large files. However, memory is used for undo and other things. If you delete a lot of text you can still run out of memory.

If Vim gives an "Out of memory" warning you should stop editing. Result of further editing actions is unpredictable. Setting 'undolevels' to 0 saves some memory. Running the maze macros on a big maze is guaranteed to run out of memory, because each change is remembered for undo. In this case set 'undolevels' to a negative number. This will switch off undo completely. Since virtual memory is used, it is highly unlikely that you will run out of memory.

How do you paste into Vim when running Windows 95?
In the properties dialog box for the MS-DOS window, go to "MS-DOS Prompt/Misc/Fast pasting" and make sure that it is NOT checked.
How do you make Vim use N lines (or N columns) in Windows NT?
In Windows NT, bring up the Properties dialog box for the Command Prompt window, go to "Screen Size and Position", and change the Buffer Size and the Window Size. Note that this applies to the current session of vim only, even if you tell NT to "save properties for future windows with same title". If you always want to run Vim at some unusual resolution, you'll have to set the properties of the command prompt window(s) permanently, or set 'lines' and/or 'columns' in your _vimrc.
How do you make Vim use N lines (or N columns) in Windows 95?
The window can only be set to one of three choices before starting Vim: 80x25, 80x43, or 80x50. To change the size, go to the titlebar of the window (or the icon/shortcut for it), select properties/screen and change "initial size" to your desired value, select "apply" and/or "OK". Then quit the window and start it again. Once Vim is running you can change the window height with ":set lines=33" and ":set columns=100". This can also be included in your _vimrc. You will notice that not only does the window size change, Vim becomes a lot faster too! Don't ask us why, ask Microsoft :-)

Send feedback on this page to Rajesh Kallingal
For Vim version 3.24. Last modification: 1996 Apr 25