PC-specific set options to Vi 

Miscellaneous Information


Vi recognizes as the left hand side of the map and map! statements single keystrokes which are not ASCII characters. Such keystrokes are represented by a keyword whose first character is #. They are transmitted by a key on the PC but do not necessarily have any ASCII equivalent.

Keyword Symbol Function Default Default
map map!

#up Cursor Up k ESCka
#down Cursor Down j ESCja
#left Cursor Left h ESCha
#right Cursor Right l ESCla
#ppage PgUp Page Up ^B ESC^Bi
#npage PgDn Page Down ^F ESC^Fi
#home Home Top Left H ESCHi
#end End End of Line $ ESC$a
#insert Ins Insert i ESCia
#delete Del Delete x ESC xi
#backtab |-> Shift-Tab
#ctrl-left CTRL-← Control Left-Arrow 0 ESC0i
#ctrl-right CTRL-→ Control Right-Arrow $ ESC$a
#ctrl-up CTRL-↑ Control Up-Arrow
#ctrl-down CTRL-↓ Control Down-Arrow
#ctrl-end CTRL-End Control End
#ctrl-npage CTRL-PgDn Control Page Down
#ctrl-ppage CTRL-PgUp Control Page Up
#ctrl-home CTRL-Home Control Home
#1 F1 Function 1
#11 F11 Shift Function 1
#20 F20 Shift Function 10
#alt-a ALT-A Alternate A
#alt-z ALT-Z Alternate Z
#alt-0 ALT-0 Alternate 0
#alt-9 ALT-9 Alternate 9

Table 1: Mapping Non-ASCII Characters in vi


The following list contains PC-specific details about set option variables. If the variable is prefixed with no, it defaults to off. Default values are shown after =. The minimal abbreviation is shown after the comma.


This allows every character on the screen to be displayed in a non-normal attribute. This attribute value is or'ed into each character cell on the screen. Normally the least significant byte of each cell is the character and the most significant byte is the attribute. The default is to make each cell the normal white on black. To make your screen inverse video, set attrib to 0x02000000. See your display adaptor manual for a full listing of the attributes available.

The value assigned to attrib has the form 0xAABF0000 where AA is a two digit value for a screen attribute (02 is inverse video, 08 is bold) and F and B are the foreground and background colors for the screen. The values used for F and B are the same ones used with the color utility.


The cursor variable sets the cursor size to percentage of the character height. For example,

set cursor=50

would set the cursor size to 50% of a character position.


The cursorins variable sets the cursor size to a percentage of the character height. For example,

set cursorin=30

would set the cursor size to 30% of a character position.


This lets you set the attributes associated with an error message. The default is inverse video.


When this option is on (that is, set as native), Vi uses the device's own character set to display characters that are normally unprintable. See the section on Non-Printable Characters.

The native variable is ignored by viw.


When you type a ! command, vi uses the chosen command interpreter to run a single command, and informs this command interpreter to run non-interactively if possible. The default value of this variable depends upon the value of the SHELL environment variable. If you've set SHELL, then the default value for shelliopt is -i. If you haven't set SHELL, then shelliopt has no value (as and cmd.exe don't require a special option).


When you type a ! command, vi uses the chosen command interpreter to run a single command. To accomplish this, it invokes the command interpreter with an option that runs a specified command and exits. For, this is /c and for MKS KornShell, this is -c. If the name of the command interpreter (set by the shell variable) was taken from the SHELL environment variable, then shellopt defaults to -c; otherwise it defaults to /c.


On PCs, line delimiters are generally RETURN-NEWLINE. Under most other systems (including UNIX and POSIX systems), they are simply NEWLINE. Therefore Vi deletes all RETURN characters followed by a NEWLINE upon input (RETURN characters not followed by a NEWLINE are passed through), and inserts a single RETURN before each NEWLINE upon output. If tosscr is set off, RETURN is treated like any other character, and normal files show up with ^M on the end of each line.

Non-Printable Characters

By default non-printable characters with values greater than 0x7F are displayed as a caret (^) followed by two hex digits indicating their value. These characters may be generated through the keyboard by using any of the KEYBxx commands, or by holding the ALT key and typing a decimal number on the keypad. Non-printable characters with values less than 0x80 are displayed as a caret (^) followed by the character representing the control character.

On the PC display, all characters are actually printable. Thus, we define non-printable characters as the control characters, and those from 0x7F and up that are not alphabetic letters. So, for example, 0x9E, being an accented E is considered printable, while 0xD0, being a box drawing character, is considered non-printable.

Setting the native variable displays all unprintable characters in the device's own character set. Thus non-ASCII and control characters are shown on the PC display as accented characters, currency symbols, and other special characters such as happy faces and musical notes.


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


color, vi


PTC MKS Toolkit 10.3 Documentation Build 39.