7. DISPLAY MODES

A "display mode" consists primarily of an algorithm that elvis uses internally to convert the bytes in a buffer into an image in a window. The same algorithm is also used for printing via the ":lpr" command.

The display mode also affects tag lookup, and image-dependent operations such as determining the column number of the cursor's location, and moving the cursor vertically.

You can list the supported display modes by giving the ":display" command without any arguments. Typically, the supported modes will include the following:

.--------.----------------------------------------------.
|  MODE  | DESCRIPTION                                  |
|--------|----------------------------------------------|
| normal | Traditional vi, displays plain ASCII         |
| syntax | Like "normal" but does syntax coloring       |
| hex    | Interactive hex dump, good for binary files  |
| html   | Simple Web page formatter                    |
| man    | Simple Man page formatter, like "nroff -man" |
| tex    | Simple subset of the TeX formatter           |
^--------^----------------------------------------------^

Elvis 2.1 allows each window to be in a different display mode. You can manually change a window's display mode via the ":display mode" command, where mode is the name of a supported display mode. There is also a ":no" command, which is short for ":display normal".

7.1 Options

There are two options which pertain to display modes: display and bufdisplay.

The display option is associated with a window. It always contains the name of the window's current display mode. You aren't allowed to change the value of this option directly; you must use the ":display mode" command to change the display mode. This option exists solely so that you can write EX scripts which behave differently, depending on the display mode.

The bufdisplay option is associated with a buffer. It should be set to the name of the usual display mode for that buffer. Typically this option will be set from the elvis.arf initialization file, based on the name of the file like this:

	let e=tolower(dirext(filename))
	if knownsyntax(filename)
	then set! bufdisplay=syntax
	else if os=="unix" && buflines >= 1
	then 1s/^#! *[^ ]*\/\([^ ]\+\).*/set! bufdisplay="syntax \1"/x
	if e<<4==".htm"
	then set! bufdisplay=html
	if e==".man" || e==".1"
	then set! bufdisplay=man
	if binary
	then set! bufdisplay=hex
When a new window is created for that buffer, or an existing window switches to that buffer, that window's display mode will automatically be switched to the bufdisplay mode.

The bufdisplay mode also affects the ^Wd visual command. This command toggles the window between the normal mode and the bufdisplay mode. If bufdisplay is also set to "normal", then ^Wd will toggle between the normal and hex display modes.

7.2 Normal mode

The "normal" display mode looks like a traditional vi screen. All characters are displayed literally except for the following...
Tab
The tab character is displayed as a variable number of spaces -- however many are needed to move to the next tabstop position.
Newline
The newline character (linefeed) marks the end of a line.
Other control characters
Control characters other than tab and newline are displayed as a caret and a printable ASCII character. For example Control-A is displayed as ^A, and NUL is displayed as ^@. The delete character is displayed as ^?.
Non-ASCII characters
The appearance of non-ASCII characters (i.e., characters 128-255) is controlled by the nonascii option. By default, most non-ASCII characters are assumed to be ordinary printable characters.

7.3 Syntax mode

The "syntax" display mode acts exactly like the normal mode, except that this mode automatically uses different fonts for various types of tokens in any supported programming language. You can then use the :color command to assign colors for each font.

7.3.1 Options

The following options determine which font is used for each type of token:
.---------------------.----------^-------------------------------------.
| OPTION NAMES        | DEFAULT  | AFFECTED TOKEN TYPE                 |
|---------------------|----------^-------------------------------------|
| commentfont, cfont  |  italic  | comments                            |
| stringfont, sfont   |  fixed   | string, character, & regexp literals|
| prepfont, pfont     |emphasized| preprocessor directives             |
| keywordfont, kfont  |   bold   | keywords                            |
| functionfont, ffont |  normal  | identifier followed by function char|
| otherfont, ofont    |   bold   | other special words                 |
| variablefont, vfont |  normal  | variables, fields, etc.             |
^---------------------^----------^-------------------------------------^
Each of those options can be set to one of normal, bold, italic, underlined, emphasized, or fixed. When typing these values into a :set command line, you are only required to type the initial letter (n, b, i, u, e or f).

Any text that doesn't fall into one of the above groups (punctuation, mostly) is displayed in the normal font. There is no option that controls this; it is hard coded.

You can use the :color command to choose a color for each font, if you wish. Not all user interfaces support color, but the "x11" and "termcap" interfaces do.

7.3.2 Language specification

All supported languages are described in a file named "elvis.syn". Each time a window switches to the "syntax" display mode, elvis scans this file for a description of the language. If it can't find a description of the language, then nothing will be displayed in a different font; "syntax" mode will look exactly like "normal" mode.

The "elvis.syn" file is a text file. In it, blank lines and lines which start with a '#' are ignored. Other lines begin with the name of an attribute; the remaining words in the line are values for that attribute. Each language's description begins with an attribute named "language". The following lines (up to the next "language" line or the end of the file) describe that language.

The attributes names are:

language
This word is followed by a whitespace-delimited list of language names. The names are case-sensitive, so you should probably give all names in lowercase so they're easier for the user to type in. The user can indicate which language to use by appending its name to the name of the "syntax" display mode. For example, ":display syntax c++" causes elvis to highlight the text appropriately for C++.
extension
This word is followed by the filename extensions which are commonly used for this language. If the user doesn't specify which language to load, then elvis scans through "elvis.syn" for an extension line which matches the current file name. The extension lines must come immediately after the language line.

NOTE: This is case sensitive! If the file name extension will often be used on case-insensitive file systems (e.g., most Microsoft) then you'll probably want to give both uppercase and lowercase versions of the extension. For example, the description of Microsoft batch file syntax includes "extension .bat .BAT".

keyword
This word is followed by a list of words which should be shown in the keywordfont font. If omitted, then no words are shown in the keywordfont. Long lists can be split into several keyword lines, if you wish. Elvis doesn't care about the order of the words, but the list will be easier to maintain if you keep it alphabetized.

Elvis supports three forms of keywords...

You can list the same keyword in multiple lines (once each in a keyword line, a font line, an anchor line, and a comment line) to specify the various attributes of each keyword. You don't need to list it in a keyword line first; you can introduce new keywords in any of these four line types.

font
This word can be used to cause certain keywords to be displayed in some font other than the keywordfont. The first word after font should be the name of the font (normal, fixed, bold, emphasized, italic, or underlined) or a one-letter abbreviation of a font name. The line's remaining words are keywords which will be displayed in that font.
anchor
This offers a way to restrict certain keywords, so they will only be recognized as such if they occur in a particular column. The bufdisplay=hex When a new window is created for that buffer, or an existing window switches to that buffer, that window's display mode will automatically be switched to the bufdisplay mode.

The bufdisplay mode also affects the ^Wd visual command. This command toggles the window between the normal mode and the bufdisplay mode. If bufdisplay is also set to "normal", then ^Wd will toggle between the normal and hex display modes.

7.2 Normal mode

The "normal" display mode looks like a traditional vi screen. All characters are displayed literally except for the following...
Tab
The tab character is displayed as a variable number of spaces -- however many are needed to move to the next tabstop position.
Newline
The newline character (linefeed) marks the end of a line.
Other control characters
Control characters other than tab and newline are displayed as a caret and a printable ASCII character. For example Control-A is displayed as ^A, and NUL is displayed as ^@. The delete character is displayed as ^?.
Non-ASCII characters
The appearance of non-ASCII characters (i.e., characters 128-255) is controlled by the nonascii option. By default, most non-ASCII characters are assumed to be ordinary printable characters.

7.3 Syntax mode

The "syntax" display mode acts exactly like the normal mode, except that this mode automatically uses different fonts for various types of tokens in any supported programming language. You can then use the :color command to assign colors for each font.

7.3.1 Options

The following options determine which font is used for each type of token:
.---------------------.----------^-------------------------------------.
| OPTION NAMES        | DEFAULT  | AFFECTED TOKEN TYPE                 |
|---------------------|----------^-------------------------------------|
| commentfont, cfont  |  italic  | comments                            |
| stringfont, sfont   |  fixed   | string, character, & regexp literals|
| prepfont, pfont     |emphasized| preprocessor directives             |
| keywordfont, kfont  |   bold   | keywords                            |
| functionfont, ffont |  normal  | identifier followed by function char|
| otherfont, ofont    |   bold   | other special words                 |
| variablefont, vfont |  normal  | variables, fields, etc.             |
^---------------------^----------^-------------------------------------^
Each of those options can be set to one of normal, bold, italic, underlined, emphasized, or fixed. When typing these values into a :set command line, you are only required to type the initial letter (n, b, i, u, e or f).

Any text that doesn't fall into one of the above groups (punctuation, mostly) is displayed in the normal font. There is no option that controls this; it is hard coded.

You can use the :color command to choose a color for each font, if you wish. Not all user interfaces support color, but the "x11" and "termcap" interfaces do.

7.3.2 Language specification

All supported languages are described in a file named "elvis.syn". Each time a window switches to the "syntax" display mode, elvis scans this file for a description of the language. If it can't find a description of the language, then nothing will be displayed in a different font; "syntax" mode will look exactly like "normal" mode.

The "elvis.syn" file is a text file. In it, blank lines and lines which start with a '#' are ignored. Other lines begin with the name of an attribute; the remaining words in the line are values for that attribute. Each language's description begins with an attribute named "language". The following lines (up to the next "language" line or the end of the file) describe that language.

The attributes names are:

language
This word is followed by a whitespace-delimited list of language names. The names are case-sensitive, so you should probably give all names in lowercase so they're easier for the user to type in. The user can indicate which language to use by appending its name to the name of the "syntax" display mode. For example, ":display syntax c++" causes elvis to highlight the text appropriately for C++.
extension
This word is followed by the filename extensions which are commonly used for this language. If the user doesn't specify which language to load, then elvis scans through "elvis.syn" for an extension line which matches the current file name. The extension lines must come immediately after the language line.

NOTE: This is case sensitive! If the file name extension will often be used on case-insensitive file systems (e.g., most Microsoft) then you'll probably want to give both uppercase and lowercase versions of the extension. For example, the description of Microsoft batch file syntax includes "extension .bat .BAT".

keyword
This word is followed by a list of words which should be shown in the keywordfont font. If omitted, then no words are shown in the keywordfont. Long lists can be split into several keyword lines, if you wish. Elvis doesn't care about the order of the words, but the list will be easier to maintain if you keep it alphabetized.

Elvis supports three forms of keywords...

  • Most keywords begin with an alphanumeric character or a character in the startword list, and continue with zero or more characters which are alphanumeric or in the inword list.
  • The same startword/inword type of keywords can be made somewhat context sensitive by appending a single character which does not appear in the inword. The keyword will only be recognized when it is immediately followed by that character. The HTML syntax highlighting uses this feature to display parameters in a distinctive font.
  • Rarely, you may find it convenient to have keywords which consist of one or two punctuation characters, but which don't match the first form of keywords. This is mostly so that Perl's $# variable won't be displayed as a simple dollar sign followed by a comment.

You can list the same keyword in multiple lines (once each in a keyword line, a font line, an anchor line, and a comment line) to specify the various attributes of each keyword. You don't need to list it in a keyword line first; you can introduce new keywords in any of these four line types.

font
This word can be used to cause certain keywords to be displayed in some font other than the keywordfont. The first word after font should be the name of the font (normal, fixed, bold, emphasized, italic, or underlined) or a one-letter abbreviation of a font name. The line's remaining words are keywords which will be displayed in that font.
anchor
This offers a way to restrict certain keywords, so they will only be recognized as such if they occur in a particular column. The bufdisplay=hex When a new window is created for that buffer, or an existing window switches to that buffer, that window's display mode will automatically be switched to the bufdisplay mode.

The bufdisplay mode also affects the ^Wd visual command. This command toggles the window between the normal mode and the bufdisplay mode. If bufdisplay is also set to "normal", then ^Wd will toggle between the normal and hex display modes.

7.2 Normal mode

The "normal" display mode looks like a traditional vi screen. All characters are displayed literally except for the following...
Tab
The tab character is displayed as a variable number of spaces -- however many are needed to move to the next tabstop position.
Newline
The newline character (linefeed) marks the end of a line.
Other control characters
Control characters other than tab and newline are displayed as a caret and a printable ASCII character. For example Control-A is displayed as ^A, and NUL is displayed as ^@. The delete character is displayed as ^?.
Non-ASCII characters
The appearance of non-ASCII characters (i.e., characters 128-255) is controlled by the nonascii option. By default, most non-ASCII characters are assumed to be ordinary printable characters.

7.3 Syntax mode

The "syntax" display mode acts exactly like the normal mode, except that this mode automatically uses different fonts for various types of tokens in any supported programming language. You can then use the :color command to assign colors for each font.

7.3.1 Options

The following options determine which font is used for each type of token:
.---------------------.----------^-------------------------------------.
| OPTION NAMES        | DEFAULT  | AFFECTED TOKEN TYPE                 |
|---------------------|----------^-------------------------------------|
| commentfont, cfont  |  italic  | comments                            |
| stringfont, sfont   |  fixed   | string, character, & regexp literals|
| prepfont, pfont     |emphasized| preprocessor directives             |
| keywordfont, kfont  |   bold   | keywords                            |
| functionfont, ffont |  normal  | identifier followed by function char|
| otherfont, ofont    |   bold   | other special words                 |
| variablefont, vfont |  normal  | variables, fields, etc.             |
^---------------------^----------^-------------------------------------^
Each of those options can be set to one of normal, bold, italic, underlined, emphasized, or fixed. When typing these values into a :set command line, you are only required to type the initial letter (n, b, i, u, e or f).

Any text that doesn't fall into one of the above groups (punctuation, mostly) is displayed in the normal font. There is no option that controls this; it is hard coded.

You can use the :color command to choose a color for each font, if you wish. Not all user interfaces support color, but the "x11" and "termcap" interfaces do.

7.3.2 Language specification

All supported languages are described in a file named "elvis.syn". Each time a window switches to the "syntax" display mode, elvis scans this file for a description of the language. If it can't find a description of the language, then nothing will be displayed in a different font; "syntax" mode will look exactly like "normal" mode.

The "elvis.syn" file is a text file. In it, blank lines and lines which start with a '#' are ignored. Other lines begin with the name of an attribute; the remaining words in the line are values for that attribute. Each language's description begins with an attribute named "language". The following lines (up to the next "language" line or the end of the file) describe that language.

The attributes names are:

language
This word is followed by a whitespace-delimited list of language names. The names are case-sensitive, so you should probably give all names in lowercase so they're easier for the user to type in. The user can indicate which language to use by appending its name to the name of the "syntax" display mode. For example, ":display syntax c++" causes elvis to highlight the text appropriately for C++.
extension
This word is followed by the filename extensions which are commonly used for this language. If the user doesn't specify which language to load, then elvis scans through "elvis.syn" for an extension line which matches the current file name. The extension lines must come immediately after the language line.

NOTE: This is case sensitive! If the file name extension will often be used on case-insensitive file systems (e.g., most Microsoft) then you'll probably want to give both uppercase and lowercase versions of the extension. For example, the description of Microsoft batch file syntax includes "extension .bat .BAT".

keyword
This word is followed by a list of words which should be shown in the keywordfont font. If omitted, then no words are shown in the keywordfont. Long lists can be split into several keyword lines, if you wish. Elvis doesn't care about the order of the words, but the list will be easier to maintain if you keep it alphabetized.

Elvis supports three forms of keywords...

  • Most keywords begin with an alphanumeric character or a character in the startword list, and continue with zero or more characters which are alphanumeric or in the inword list.
  • The same startword/inword type of keywords can be made somewhat context sensitive by appending a single character which does not appear in the inword. The keyword will only be recognized when it is immediately followed by that character. The HTML syntax highlighting uses this feature to display parameters in a distinctive font.
  • Rarely, you may find it convenient to have keywords which consist of one or two punctuation characters, but which don't match the first form of keywords. This is mostly so that Perl's $# variable won't be displayed as a simple dollar sign followed by a comment.

You can list the same keyword in multiple lines (once each in a keyword line, a font line, an anchor line, and a comment line) to specify the various attributes of each keyword. You don't need to list it in a keyword line first; you can introduce new keywords in any of these four line types.

font
This word can be used to cause certain keywords to be displayed in some font other than the keywordfont. The first word after font should be the name of the font (normal, fixed, bold, emphasized, italic, or underlined) or a one-letter abbreviation of a font name. The line's remaining words are keywords which will be displayed in that font.
anchor
This offers a way to restrict certain keywords, so they will only be recognized as such if they occur in a particular column. The bufdisplay=hex When a new window is created for that buffer, or an existing window switches to that buffer, that window's display mode will automatically be switched to the bufdisplay mode.

The bufdisplay mode also affects the ^Wd visual command. This command toggles the window between the normal mode and the bufdisplay mode. If bufdisplay is also set to "normal", then ^Wd will toggle between the normal and hex display modes.

7.2 Normal mode

The "normal" display mode looks like a traditional vi screen. All characters are displayed literally except for the following...
Tab
The tab character is displayed as a variable number of spaces -- however many are needed to move to the next tabstop position.
Newline
The newline character (linefeed) marks the end of a line.
Other control characters
Control characters other than tab and newline are displayed as a caret and a printable ASCII character. For example Control-A is displayed as ^A, and NUL is displayed as ^@. The delete character is displayed as ^?.
Non-ASCII characters
The appearance of non-ASCII characters (i.e., characters 128-255) is controlled by the nonascii option. By default, most non-ASCII characters are assumed to be ordinary printable characters.

7.3 Syntax mode

The "syntax" display mode acts exactly like the normal mode, except that this mode automatically uses different fonts for various types of tokens in any supported programming language. You can then use the :color command to assign colors for each font.

7.3.1 Options

The following options determine which font is used for each type of token:
.---------------------.----------^-------------------------------------.
| OPTION NAMES        | DEFAULT  | AFFECTED TOKEN TYPE                 |
|---------------------|----------^-------------------------------------|
| commentfont, cfont  |  italic  | comments                            |
| stringfont, sfont   |  fixed   | string, character, & regexp literals|
| prepfont, pfont     |emphasized| preprocessor directives             |
| keywordfont, kfont  |   bold   | keywords                            |
| functionfont, ffont |  normal  | identifier followed by function char|
| otherfont, ofont    |   bold   | other special words                 |
| variablefont, vfont |  normal  | variables, fields, etc.             |
^---------------------^----------^-------------------------------------^
Each of those options can be set to one of normal, bold, italic, underlined, emphasized, or fixed. When typing these values into a :set command line, you are only required to type the initial letter (n, b, i, u, e or f).

Any text that doesn't fall into one of the above groups (punctuation, mostly) is displayed in the normal font. There is no option that controls this; it is hard coded.

You can use the :color command to choose a color for each font, if you wish. Not all user interfaces support color, but the "x11" and "termcap" interfaces do.

7.3.2 Language specification

All supported languages are described in a file named "elvis.syn". Each time a window switches to the "syntax" display mode, elvis scans this file for a description of the language. If it can't find a description of the language, then nothing will be displayed in a different font; "syntax" mode will look exactly like "normal" mode.

The "elvis.syn" file is a text file. In it, blank lines and lines which start with a '#' are ignored. Other lines begin with the name of an attribute; the remaining words in the line are values for that attribute. Each language's description begins with an attribute named "language". The following lines (up to the next "language" line or the end of the file) describe that language.

The attributes names are:

language
This word is followed by a whitespace-delimited list of language names. The names are case-sensitive, so you should probably give all names in lowercase so they're easier for the user to type in. The user can indicate which language to use by appending its name to the name of the "syntax" display mode. For example, ":display syntax c++" causes elvis to highlight the text appropriately for C++.
extension
This word is followed by the filename extensions which are commonly used for this language. If the user doesn't specify which language to load, then elvis scans through "elvis.syn" for an extension line which matches the current file name. The extension lines must come immediately after the language line.

NOTE: This is case sensitive! If the file name extension will often be used on case-insensitive file systems (e.g., most Microsoft) then you'll probably want to give both uppercase and lowercase versions of the extension. For example, the description of Microsoft batch file syntax includes "extension .bat .BAT".

keyword
This word is followed by a list of words which should be shown in the keywordfont font. If omitted, then no words are shown in the keywordfont. Long lists can be split into several keyword lines, if you wish. Elvis doesn't care about the order of the words, but the list will be easier to maintain if you keep it alphabetized.

Elvis supports three forms of keywords...

  • Most keywords begin with an alphanumeric character or a character in the startword list, and continue with zero or more characters which are alphanumeric or in the inword list.
  • The same startword/inword type of keywords can be made somewhat context sensitive by appending a single character which does not appear in the inword. The keyword will only be recognized when it is immediately followed by that character. The HTML syntax highlighting uses this feature to display parameters in a distinctive font.
  • Rarely, you may find it convenient to have keywords which consist of one or two punctuation characters, but which don't match the first form of keywords. This is mostly so that Perl's $# variable won't be displayed as a simple dollar sign followed by a comment.

You can list the same keyword in multiple lines (once each in a keyword line, a font line, an anchor line, and a comment line) to specify the various attributes of each keyword. You don't need to list it in a keyword line first; you can introduce new keywords in any of these four line types.

font
This word can be used to cause certain keywords to be displayed in some font other than the keywordfont. The first word after font should be the name of the font (normal, fixed, bold, emphasized, italic, or underlined) or a one-letter abbreviation of a font name. The line's remaining words are keywords which will be displayed in that font.
anchor
This offers a way to restrict certain keywords, so they will only be recognized as such if they occur in a particular column. The bufdisplay=hex When a new window is created for that buffer, or an existing window switches to that buffer, that window's display mode will automatically be switched to the bufdisplay mode.

The bufdisplay mode also affects the ^Wd visual command. This command toggles the window between the normal mode and the bufdisplay mode. If bufdisplay is also set to "normal", then ^Wd will toggle between the normal and hex display modes.

7.2 Normal mode

The "normal" display mode looks like a traditional vi screen. All characters are displayed literally except for the following...
Tab
The tab character is displayed as a variable number of spaces -- however many are needed to move to the next tabstop position.
Newline
The newline character (linefeed) marks the end of a line.
Other control characters
Control characters other than tab and newline are displayed as a caret and a printable ASCII character. For example Control-A is displayed as ^A, and NUL is displayed as ^@. The delete character is displayed as ^?.
Non-ASCII characters
The appearance of non-ASCII characters (i.e., characters 128-255) is controlled by the nonascii option. By default, most non-ASCII characters are assumed to be ordinary printable characters.

7.3 Syntax mode

The "syntax" display mode acts exactly like the normal mode, except that this mode automatically uses different fonts for various types of tokens in any supported programming language. You can then use the :color command to assign colors for each font.

7.3.1 Options

The following options determine which font is used for each type of token:
.---------------------.----------^-------------------------------------.
| OPTION NAMES        | DEFAULT  | AFFECTED TOKEN TYPE                 |
|---------------------|----------^-------------------------------------|
| commentfont, cfont  |  italic  | comments                            |
| stringfont, sfont   |  fixed   | string, character, & regexp literals|
| prepfont, pfont     |emphasized| preprocessor directives             |
| keywordfont, kfont  |   bold   | keywords                            |
| functionfont, ffont |  normal  | identifier followed by function char|
| otherfont, ofont    |   bold   | other special words                 |
| variablefont, vfont |  normal  | variables, fields, etc.             |
^---------------------^----------^-------------------------------------^
Each of those options can be set to one of normal, bold, italic, underlined, emphasized, or fixed. When typing these values into a :set command line, you are only required to type the initial letter (n, b, i, u, e or f).

Any text that doesn't fall into one of the above groups (punctuation, mostly) is displayed in the normal font. There is no option that controls this; it is hard coded.

You can use the :color command to choose a color for each font, if you wish. Not all user interfaces support color, but the "x11" and "termcap" interfaces do.

7.3.2 Language specification

All supported languages are described in a file named "elvis.syn". Each time a window switches to the "syntax" display mode, elvis scans this file for a description of the language. If it can't find a description of the language, then nothing will be displayed in a different font; "syntax" mode will look exactly like "normal" mode.

The "elvis.syn" file is a text file. In it, blank lines and lines which start with a '#' are ignored. Other lines begin with the name of an attribute; the remaining words in the line are values for that attribute. Each language's description begins with an attribute named "language". The following lines (up to the next "language" line or the end of the file) describe that language.

The attributes names are:

language
This word is followed by a whitespace-delimited list of language names. The names are case-sensitive, so you should probably give all names in lowercase so they're easier for the user to type in. The user can indicate which language to use by appending its name to the name of the "syntax" display mode. For example, ":display syntax c++" causes elvis to highlight the text appropriately for C++.
extension
This word is followed by the filename extensions which are commonly used for this language. If the user doesn't specify which language to load, then elvis scans through "elvis.syn" for an extension line which matches the current file name. The extension lines must come immediately after the language line.

NOTE: This is case sensitive! If the file name extension will often be used on case-insensitive file systems (e.g., most Microsoft) then you'll probably want to give both uppercase and lowercase versions of the extension. For example, the description of Microsoft batch file syntax includes "extension .bat .BAT".

keyword
This word is followed by a list of words which should be shown in the keywordfont font. If omitted, then no words are shown in the keywordfont. Long lists can be split into several keyword lines, if you wish. Elvis doesn't care about the order of the words, but the list will be easier to maintain if you keep it alphabetized.

Elvis supports three forms of keywords...

  • Most keywords begin with an alphanumeric character or a character in the startword list, and continue with zero or more characters which are alphanumeric or in the inword list.
  • The same startword/inword type of keywords can be made somewhat context sensitive by appending a single character which does not appear in the inword. The keyword will only be recognized when it is immediately followed by that character. The HTML syntax highlighting uses this feature to display parameters in a distinctive font.
  • Rarely, you may find it convenient to have keywords which consist of one or two punctuation characters, but which don't match the first form of keywords. This is mostly so that Perl's $# variable won't be displayed as a simple dollar sign followed by a comment.

You can list the same keyword in multiple lines (once each in a keyword line, a font line, an anchor line, and a comment line) to specify the various attributes of each keyword. You don't need to list it in a keyword line first; you can introduce new keywords in any of these four line types.

font
This word can be used to cause certain keywords to be displayed in some font other than the keywordfont. The first word after font should be the name of the font (normal, fixed, bold, emphasized, italic, or underlined) or a one-letter abbreviation of a font name. The line's remaining words are keywords which will be displayed in that font.
anchor
This offers a way to restrict certain keywords, so they will only be recognized as such if they occur in a particular column. The bufdisplay=hex When a new window is created for that buffer, or an existing window switches to that buffer, that window's display mode will automatically be switched to the bufdisplay mode.

The bufdisplay mode also affects the ^Wd visual command. This command toggles the window between the normal mode and the bufdisplay mode. If bufdisplay is also set to "normal", then ^Wd will toggle between the normal and hex display modes.

7.2 Normal mode

The "normal" display mode looks like a traditional vi screen. All characters are displayed literally except for the following...
Tab
The tab character is displayed as a variable number of spaces -- however many are needed to move to the next tabstop position.
Newline
The newline character (linefeed) marks the end of a line.
Other control characters
Control characters other than tab and newline are displayed as a caret and a printable ASCII character. For example Control-A is displayed as ^A, and NUL is displayed as ^@. The delete character is displayed as ^?.
Non-ASCII characters
The appearance of non-ASCII characters (i.e., characters 128-255) is controlled by the nonascii option. By default, most non-ASCII characters are assumed to be ordinary printable characters.

7.3 Syntax mode

The "syntax" display mode acts exactly like the normal mode, except that this mode automatically uses different fonts for various types of tokens in any supported programming language. You can then use the :color command to assign colors for each font.

7.3.1 Options

The following options determine which font is used for each type of token:
.---------------------.----------^-------------------------------------.
| OPTION NAMES        | DEFAULT  | AFFECTED TOKEN TYPE                 |
|---------------------|----------^-------------------------------------|
| commentfont, cfont  |  italic  | comments                            |
| stringfont, sfont   |  fixed   | string, character, & regexp literals|
| prepfont, pfont     |emphasized| preprocessor directives             |
| keywordfont, kfont  |   bold   | keywords                            |
| functionfont, ffont |  normal  | identifier followed by function char|
| otherfont, ofont    |   bold   | other special words                 |
| variablefont, vfont |  normal  | variables, fields, etc.             |
^---------------------^----------^-------------------------------------^
Each of those options can be set to one of normal, bold, italic, underlined, emphasized, or fixed. When typing these values into a :set command line, you are only required to type the initial letter (n, b, i, u, e or f).

Any text that doesn't fall into one of the above groups (punctuation, mostly) is displayed in the normal font. There is no option that controls this; it is hard coded.

You can use the :color command to choose a color for each font, if you wish. Not all user interfaces support color, but the "x11" and "termcap" interfaces do.

7.3.2 Language specification

All supported languages are described in a file named "elvis.syn". Each time a window switches to the "syntax" display mode, elvis scans this file for a description of the language. If it can't find a description of the language, then nothing will be displayed in a different font; "syntax" mode will look exactly like "normal" mode.

The "elvis.syn" file is a text file. In it, blank lines and lines which start with a '#' are ignored. Other lines begin with the name of an attribute; the remaining words in the line are values for that attribute. Each language's description begins with an attribute named "language". The following lines (up to the next "language" line or the end of the file) describe that language.

The attributes names are:

language
This word is followed by a whitespace-delimited list of language names. The names are case-sensitive, so you should probably give all names in lowercase so they're easier for the user to type in. The user can indicate which language to use by appending its name to the name of the "syntax" display mode. For example, ":display syntax c++" causes elvis to highlight the text appropriately for C++.
extension
This word is followed by the filename extensions which are commonly used for this language. If the user doesn't specify which language to load, then elvis scans through "elvis.syn" for an extension line which matches the current file name. The extension lines must come immediately after the language line.

NOTE: This is case sensitive! If the file name extension will often be used on case-insensitive file systems (e.g., most Microsoft) then you'll probably want to give both uppercase and lowercase versions of the extension. For example, the description of Microsoft batch file syntax includes "extension .bat .BAT".

keyword
This word is followed by a list of words which should be shown in the keywordfont font. If omitted, then no words are shown in the keywordfont. Long lists can be split into several keyword lines, if you wish. Elvis doesn't care about the order of the words, but the list will be easier to maintain if you keep it alphabetized.

Elvis supports three forms of keywords...

  • Most keywords begin with an alphanumeric character or a character in the startword list, and continue with zero or more characters which are alphanumeric or in the inword list.
  • The same startword/inword type of keywords can be made somewhat context sensitive by appending a single character which does not appear in the inword. The keyword will only be recognized when it is immediately followed by that character. The HTML syntax highlighting uses this feature to display parameters in a distinctive font.
  • Rarely, you may find it convenient to have keywords which consist of one or two punctuation characters, but which don't match the first form of keywords. This is mostly so that Perl's $# variable won't be displayed as a simple dollar sign followed by a comment.

You can list the same keyword in multiple lines (once each in a keyword line, a font line, an anchor line, and a comment line) to specify the various attributes of each keyword. You don't need to list it in a keyword line first; you can introduce new keywords in any of these four line types.

font
This word can be used to cause certain keywords to be displayed in some font other than the keywordfont. The first word after font should be the name of the font (normal, fixed, bold, emphasized, italic, or underlined) or a one-letter abbreviation of a font name. The line's remaining words are keywords which will be displayed in that font.
anchor
This offers a way to restrict certain keywords, so they will only be recognized as such if they occur in a particular column. The bufdisplay=hex When a new window is created for that buffer, or an existing window switches to that buffer, that window's display mode will automatically be switched to the bufdisplay mode.

The bufdisplay mode also affects the ^Wd visual command. This command toggles the window between the normal mode and the bufdisplay mode. If bufdisplay is also set to "normal", then ^Wd will toggle between the normal and hex display modes.

7.2 Normal mode

The "normal" display mode looks like a traditional vi screen. All characters are displayed literally except for the following...
Tab
The tab character is displayed as a variable number of spaces -- however many are needed to move to the next tabstop position.
Newline
The newline character (linefeed) marks the end of a line.
Other control characters
Control characters other than tab and newline are displayed as a caret and a printable ASCII character. For example Control-A is displayed as ^A, and NUL is displayed as ^@. The delete character is displayed as ^?.
Non-ASCII characters
The appearance of non-ASCII characters (i.e., characters 128-255) is controlled by the nonascii option. By default, most non-ASCII characters are assumed to be ordinary printable characters.