SYNOPSIS
viw [
viw [
DESCRIPTION
viw (or Vi for Windows) is the vi editor modified for the Windows environment. It supports all of the features of vi with the added benefits of Windows. Features unique to viw are displayed in this reference page.
A version of viw can also be used as the editor for Microsoft Visual Studio. For details, see the viw_vs reference page.
Besides the menu bar described in the Menu Bar section of this reference page, viw has a few unique features not found in vi.
The most obvious of these features is the ability to use the mouse to reposition the cursor. Not only can you place the cursor at any point in the editing window by positioning the mouse and left clicking, but you can also use the scroll bar on the right side of the editing window to scroll back and forth through files that are larger than the window.
The status line at the very bottom of the viw window is divided into three sections. The first section displays information about the current file and the viw window itself in the form:
lines_in_file:curr_line:curr_pos heightxwidth
where lines_in_file is the number of lines in the current file, curr_line is the current line where the cursor is positioned, curr_pos is the position of the cursor on that line, height is the height of the editing window in lines, and width is the width of the editing window in characters,
The next section of the status line displays the editor's current mode. This can be Append, Insert, or Command. Append is displayed when newly typed characters will be appended after the current cursor position. Insert is displayed when newly typed characters will be inserted before the current cursor position. Command is displayed when you are entering an Ex command.
The final section of the status line is used to display messages as needed.
The command window is a single line window directly above the status line. It is in this window that you enter Ex commands. You can access this window either by using : to change modes as in vi or by positioning the mouse over this window and left clicking. In addition, by selecting the down arrow at the far right of this window, you can view a list of previous Ex commands entered. By left clicking on a command in this list, you can have that command placed in the command window where it can be edited and applied like any other Ex command.
Finally, when you open or save a file using the File > Open, File > Save, or File > Save As menu items, the file selector dialog that appears has a Character Set dropdown list with the following selections:
Detect character set ASCII characters from the ANSI code page ASCII characters from the OEM code page Unicode - Big endian 16-bit wide characters Unicode - Little endian 16-bit wide characters UTF-8 characters
Selecting the Detect character set option for File > Open has the same effect as infileformat being set to DETECT, while selecting the same option for File > Save or File > Save As has the effect as outfileformat or defaultfileformat (depending upon whether or not the file being saved exists or not) being set to DETECT.
The rest of the options correspond to the ASCII_ANSI,
ASCII_OEM, UNICODE_BIG_ENDIAN,
UNICODE_LITTLE_ENDIAN, UTF-8 character file
formats described in the
File Character Formats section of the
unicode reference page.
The effect is the same as specifying the corresponding file format with
Options
The following option is unique to viw. Additionally, the options detailed in the vi reference page may also be used.
-n prof-
specifies the name of a profile to use for a viw session. Each profile saves the color scheme, recently used files, Ex commands, font size, position, and File Open filter independently from the default. If a profile with the name prof exists, viw loads that profile. If there is no profile with that name, the default profile is loaded. Upon exiting viw, all changes made are stored in prof.
Set Option Variables
The following option variables are unique to viw. Additionally, the option variables detailed in the vi reference page may also be used.
- guierror
-
When this option is set, GUI errors are displayed in popup windows. When it is not set, GUI errors are displayed on the status line. Also, when it is not set, search errors are displayed on the status regardless of how the searchpopup variable is set.
The default is guierror.
- pasteafter
-
When this option is on, pasting in viw inserts the pasted text after the cursor. When this is off, the text is inserted before the cursor.
The default is nopasteafter.
- savesize
-
When this option is on, viw saves the size and position of its window when it exits and automatically restores them the next time it is started. This is equivalent to checking the Position box on the Persistence dialog displayed by selecting Persistence from the Options menu; however, as a variable, it can be set in ex.rc or TK_VIWINIT or in EXINIT if TK_VIWINIT is not set.
The default is savesize.
- searchpopup
-
When this option is on, viw pops up a window when searches fail. Setting nosearchpopup displays the messages on the status bar instead of popping up a window.
This variable only has an effect when the guierror variable is set or the Gui Errors option is set in the Messages (Options > Messages...) dialog,
The default is searchpopup.
- systemchildwindow
-
When this option is on, viw displays the output from a system call in a child window. When nosystemchildwindow is set, viw displays the output from system calls in the viw command window.
The default is nosystemchildwindow.
Menu Bar
Like most Windows applications, viw uses a menu bar to allow access to many of the vi features as well as those unique to viw
File Menu
- New
-
Creates a new text file. viw creates a blank page for you to enter text.
If you are currently editing a text file, viw asks you if you want to write any edited changes to the current file.
This is similar to the Ex edit command.
- Open...
-
Opens an existing text file. viw displays a standard Windows Open dialog to use for selecting the file.
If you are currently editing a text file, viw asks you if you want to write any edited changes to the current file.
This command has similarities to both the Ex edit command and the Ex read command.
- Save
-
Writes the current text file being edited to disk.
If the file has not been previously saved, the standard Windows Save As dialog box appears asking you to specify a file name. If the file has been previously saved, viw prompts you about whether or not to overwrite the existing file.
This command is similar to the Ex write command.
- Save As...
-
Writes the current text file being edited to disk with a specified name. The Save As dialog box appears asking you to specify a file name. If the file name selected already exists, viw prompts you about whether or not to overwrite the existing file.
This command is similar to the Ex write command.
- Print...
-
Prints the current text file being edited. The standard Windows Print dialog appears allowing you to select the printer to be used.
This command is similar to the Ex print command.
- Printer Setup
-
Lets you adjust the settings for the printer to be used by displaying the standard Windows Print Setup dialog.
- Files
-
Displays a list of the files most recently edited with viw. Click on a file in this list to edit it.
- Read...
-
Inserts the contents of another file after the current line in the file being edited. viw displays the standard Windows Open dialog to use for selecting the file.
This command is similar to the Ex read command.
- Exit
-
Ends your viw session. viw prompts you to save your file if you have made changes since it was last saved.
This command is similar to the Ex quit command.
Edit Menu
- Undo
-
Reverses the last editing action. If this option is not available, it appears in gray.
- Cut
-
Removes a selected block of text from the current file.
This block of text is temporarily saved in the Windows clipboard, as well as the viw default buffer.
This command is available only when a block of text is currently selected. You can paste the cut block of text back to its original position in the file or to another location in the file with the Paste command.
ALT-X is the keyboard equivalent for this command.
- Copy
-
Copies a selected block of text to the Windows clipboard.
This block of text is temporarily saved in the Windows clipboard, as well as the viw default buffer.
This command is only available when a block of text is selected. The copied block of text can be pasted into another location in the file with the Paste command.
ALT-C is the keyboard equivalent for this command.
- Paste
-
Inserts the contents of either the Windows clipboard or the viw default buffer at the cursor position. Paste inserts the text that was most recently stored in either one.
ALT-V is the keyboard equivalent for this command.
- Delete
-
Deletes a selected block of text.
This block of text is temporarily saved in the viw default buffer.
This command is only available when a block of text is selected. The deleted block of text can be pasted into another location in the file with the p and P object manipulator commands described in the vi reference page.
The Del key is the keyboard equivalent for this command.
- Select All
-
Selects all text in the current file.
ALT-A is the keyboard equivalent for this command.
- Search & Replace
-
Searches for and replaces text in the current file, based upon the criteria entered in the Search & Replace dialog:
- Search Pattern
-
Specifies the pattern to search for. By clicking the down arrow, you can see and select from previous search patterns entered either via this dialog or on the Ex command line. Patterns are of the same format as used for vi.
- Replace Pattern
-
Specifies the text to replace the search pattern. By clicking the down arrow, you can see and select from previous replace patterns entered either via this dialog or on the Ex command line.
- Start Address
-
Specifies an address that marks the beginning of the block of text to search. Acceptable formats for addresses are described in the Ex Command Mode section of the vi reference page.
- End Address
-
Specifies an address that marks the beginning of the block of text to search. Acceptible formats for addresses are described in the Ex Command Mode section of the vi reference page.
- Entire File
-
When checked, the entire file will be searched. This box is checked by default.
- Ignore Case
-
When checked, viw ignores case when attempting to match a search pattern.
- Confirm
-
When checked, viw prompts you before replacing text.
- Wrap Scan
-
When checked, viw continues searching at the beginning of the file when the search reaches the end of the file.
- Global Replace
-
When checked, viw replaces all occurrences of the search pattern on a line. When unchecked, only the first occurrence of a search pattern on a line is replaced.
- Forward/Backward
-
Specifies whether viw should search forward or backward from the current line when attempting to match the search pattern. Forward and Backward are radio buttons, that is, when one is selected, the other is automatically deselected. Forward is selected by default.
Macro Menu
- Map...
-
Defines or undefines a keyboard macro. When selected, the Keystroke Macros dialog appears.
At the bottom of the dialog are three radio buttons that select the mode for the macros to be listed, defined, or undefined: Command, Insert, or Abbreviate. Above those buttons is a list of the macros defined for the selected mode.
To create a new keyboard macro, first select the macros's mode using the radio buttons. Next, enter the name of the macro in the Macro Name field. For command mode and insert mode macros, this name must be a single keystroke which does not currently perform an action in the selected mode. For abbreviations, the macro name can be a currently undefined string of characters. Finally, in the Macro Substitution field, enter the keystrokes (or text) that are to replace the Macro Name when typed.
To undefine a macro, select it from the list of the defined macros and clicking Delete.
Creating a new macro is similar to the Ex map and abbreviate commands while deleting a macro is similar to the Ex unmap and unabbreviate.
Options Menu
- Text...
-
Displays the Text Options dialog. From this dialog, you can set the following text-related options:
- Shift Width
-
Specifies the width of the indent used by the shift and autoindent commands.
- Tab Stop
-
Specifies the number of characters for each tab stop.
- Wrap Margin
-
Specifies the number of characters from the right of the screen at which the line should wrap.
- Beautify
-
When checked, viw discards all non-printing characters from the text.
- List
-
When checked, viw displays tabs as ^I, and marks the ends of lines with $. This is useful for determining if a character is a tab or a space.
- Number
-
When checked, viw displays line numbers on the screen.
- Show Match
-
When checked, typing a closing parenthesis ()) or closing brace (}) automatically moves the cursor to the matching opening parenthesis or brace for a second and then back again.
- Paragraphs
-
Specifies character pairs that when preceded by a period (.) are considered paragraph boundaries (for example, .IP). These typically represent commands to text formatters such as nroff or troff.
- Sections
-
Specifies character pairs that when preceded by a period (.) are considered section boundaries (for example, .IP). These typically represent commands to text formatters such as nroff or troff.
- Scroll
-
Specifies the number of lines to scroll for the Ex z and CTRL-D commands.
- Autoindent
-
When checked, the next line of text you insert has the same indentation as the current line.
- Text
-
Displays the current text color (in hex). Click the Set button to change the text color.
- Window
-
Displays the current window (background) color (in hex). Click the Set button to change the window color.
- Search & Replace...
-
Displays the Search & Replace Options dialog. From this dialog, you can set the following options for the Search & Replace item in the Edit menu:
- Wrap Scan
-
When checked, forward searches do not stop at the end of the file and backward searches do not end at the beginning. Searches continue in a loop.
- Ignore Case
-
When selected, the case of the letters is ignored when viw attempts to match strings and regular expressions.
- ed Compatible Substitutes
-
When checked, viw attempts to make substitute commands behave in a way that is compatible with the ed editor.
- All Metacharacters are Magic
-
When checked, all regular expression characters retain their special meanings. If the option is not selected, regular expression characters (^, \, and $) become the only ones with special meanings. All other regular expression metacharacters must be preceded by a backslash (\) to retain their special meanings.
- Messages...
-
Displays the Messages dialog. From this dialog, you can set the following options that affect the display of messages on the screen:
- Modified File Warning
-
When checked, commands with ! (such as quit!) display a warning message if the current file has been modified.
- Terse Messages
-
When checked, messages are displayed in an abbreviated form.
- Quiet Mode
-
When checked, viw does not display file information messages.
- Error Bells
-
When checked, viw displays messages in reverse video.
- Visual Bell
-
When checked, viw flashes your screen as the visual equivalent of the alert character.
- Gui Errors
-
When checked, viw displays GUI errors in popup boxes. When unchecked, GUI errors are displayed on the status line. Also, when checked, search errors are displayed on the status line, regardless of how the searchpopup option variable is set.
- Report Lines
-
Specifies the maximum number of lines that can be affected by a command before a message is displayed.
- Files...
-
Displays the File Option dialog. From this dialog, you can set the following options that affect file attributes:
- File is read-only
-
When checked, you cannot write to the current file.
- Write any
-
When checked, a file marked [Not edited] overwrites an existing file.
- Autowrite
-
When checked, the current file is automatically written out if it has been changed since it was last written and you execute any of the following commands: next, rewind, tag, CTRL-^ (viw), and CTRL-] (viw). Using ! with any of these commands stops the automatic write. Note that the edit command is explicitly not part of this list.
- Tags
-
Specifies the names of the files (separated by a space) used by the tag Ex command and the CTRL-] viw command. The files are typically created with the ctags program.
- Length
-
When set to non-zero, tags are compared for this length of characters.
- Temp. Directory
-
Specifies the directory where you want viw to place the temporary files it creates. The default is /tmp.
- PC Specific...
-
Displays the PC Specific Options dialog. From this dialog, you can set the following options that affect features of viw specific to PCs:
- Line Delete Character
-
Specifies the numeric value of the character to be used as the line delete character.
- Maximum Buffers
-
Specifies the number of kilobytes (1024 bytes) of memory to be used for the editor buffers. These are allocated in units of 16K. A minimum of 32K is required. The default is 512K or the actual amount of memory available (if less than 512K).
- Use Native characters for non-printable
-
When checked, viw uses the PC's own character set to display characters that are normally unprintable (for example, a box drawing character or control characters).
- Newlines are CR/LF
-
When checked, each line is delimited by a carriage return and line feed pair of characters. Otherwise, only a line feed is used.
- Font...
-
Displays the Font dialog. From this dialog, you can set the font (and related properties) to be used for all text in the viw window. The contents of the lists shown on this dialog depend on your configuration of Windows. See your Microsoft Windows documentation for more information on adding fonts.
- Font
-
Displays the list of available fonts from which you can select for use with viw.
- Size
-
Displays the list of available type sizes for the selected font from which you can select the size to use.
- Sample
-
Displays a sample the selected font at the specified size.
- Script
-
Displays a dropdown list of available script types for the selected font.
- Reset Font
-
Resets the font used to the viw default font.
- Persistence...
-
Displays the Persistence dialog. From this dialog, you can select the features of viw that will apply to not only the current viw session but also to all future viw sessions until changed.
- File List should persist
-
When checked, viw maintains the list of files shown by the Files command when you exit. This list will be available when you next start viw. When unchecked, the list of files is not maintained.
- Ex Command Line should persist
-
When checked, viw maintains the list of previous Ex command lines when you exit. This list will be available when you next start viw. When unchecked, the list of commands is not maintained.
- Clear Cmd Line
-
When clicked, clears the list of previous Ex command lines.
- Clear File List
-
When clicked, clears the list of files shown by the Files command.
- Font
-
When checked, viw uses the same font when it next starts as was used when you last exited.
- Position
-
When checked, viw's command window is the same size and at the same screen position as when you last exited.
- Color
-
When checked, viw uses the same color combination when it next starts as it was using when you last exited.
- Misc
-
When checked, viw uses the same miscellaneous settings when it next starts as were in use when you last exited.
- Save...
-
Saves all changes you have set using the other Options menu items for use in subsequent viw editing sessions. When you select this item, the Save As dialog appears to let you specify the file that holds these option settings. The default file name is ex.rc, the start-up file that viw invokes every time it runs.
Help Menu
- vi Reference Page
-
Displays the vi reference page.
- viw Reference Page
-
Displays this reference page.
- About
-
Displays the About box for viw .
ENVIRONMENT VARIABLES
- EXINIT
-
contains a list of Vi commands to be run on editor startup if the TK_VIWINIT variable is not set.
- TK_VIWINIT
-
specifies a list of vi command to run by viw at editor startup. If this variable is not set, the EXINIT environment variable is used instead.
DIAGNOSTICS
The viw has the same exit status values as vi.
PORTABILITY
Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.
AVAILABILITY
PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- File Formats:
- vi
- Miscellaneous:
- unicode
PTC MKS Toolkit 10.5 Documentation Build 40.