X2 allows limited tailoring through the use of a user profile. The user
profile is used to customise the screen colours and some keys. It is also
used to set file extension-specific parameters such as comment formatting and
syntax expansion keywords.
It is strongly recommended that you do not modify the default
profile, xprofile.def. The default profile is frequently updated,
and shipped with each new release of the editor. If you make changes, you'll
have to re-do all your changes with each new release. A much better way is
to create a new profile, say xprofile.add, that contains
only overrides and new definitions. There is no need to copy
definitions from xprofile.def unless you want to change them, and
then you only need to copy the pieces you want to change.
A user profile can have any name. Only those lines beginning with a
recognised keyword will be processed. The profile is processed with the
XPROFILE command, with the following syntax:
where profname is the name of the profile file, and
prof2 and prof3 are optional additional profiles.
Profname will default to XPROFILE.DEF in the
current directory if it is not specified. Each profile input file will
override the settings from the previous profile.
If successful, a file
called X.PRO will be created in the current directory. Copy this file to
your XPATH and it will be read whenever you start the editor.
Note that if the editor cannot find X.PRO when it starts, it will look for
X.PRO in the same directory from which X.EXE was started. This allows you to
place a default profile with X.EXE on a common disk in a group environment,
and still allow people to override the default profile by placing one in
their XPATH directory.
The above instructions apply to the OS/2 version of the editor. Under
other operating systems the command syntax is the same, but the profile
generation program name differs, as does the output profile name. The
following table details these differences.
Creating The User Profile
XPROFILE profname <prof2 <prof3...>>
Operating System | Profiler | Profile Name |
---|---|---|
OS/2 | XPROFILE.EXE | X.PRO |
Windows NT/95 | XPROFWNT.EXE | XW32.PRO |
DOS | XPROFDOS.EXE | XDOS.PRO |
AIX | xprofile | XUNIX.PRO |
Linux | xprofile | XUNIX.PRO |
Solaris | xprofile | XUNIX.PRO |
The profile name may be changed in two ways. An environment variable
called XPRO may be set to the desired profile name, or the /P
command line option may be used to temporarily override the profile.
Under some Unix systems the environment variable XPATH is used by the
X-Windows system itself; in such cases the name X2PATH should be used in
place of XPATH.
Comments may be included in the user profile input file.
Comments either start with an asterisk
(*) character in column one, or use the sequence /* and
*/ to delimit the beginning and end of a comment. The latter
sequence may be used to denote inline comments in any profile definition
line.
Keys can be remapped with the following sequence:
where:
keyname is converted to upper case before being scanned,
therefore it can be entered in mixed case as convenient. Note that keys may
be defined globally, or for a specific file pattern. If a file extension has
been specified, the key will be defined only for that file type; otherwise,
it will be global to all
files.
User Profile Key Remap
describes the keys which can be remapped. Any command may be assigned
directly to a key.
Comments
Key Remapping
KEY keyname = function
User Profile Key Remap
Key | Profile Name | Default Function |
---|---|---|
F1 | F1 | Help |
F2 | F2 | SplitJoin |
F3 | F3 | Quit |
F4 | F4 | Save |
F5 | F5 | Rename |
F6 | F6 | "CmdText EDIT " |
F7 | F7 | PageUp |
F8 | F8 | PageDown |
F9 | F9 | Undo |
F10 | F10 | Redo |
F11 | F11 | Previous_File |
F12 | F12 | Next_File |
Backspc | Backspace | Backspace |
Delete | Delete | DelChar |
End | End | Cursor EOL |
Enter | Enter | Cursor NextLine |
Home | Home | Cursor Col1 |
Pad + | PadPlus | Keyin + |
Page Down | PgDn | PageDown |
Page Up | PgUp | PageUp |
Tab | Tab | Tab |
Shift-F1 | s-F1 | Scroll Left |
Shift-F2 | s-F2 | Scroll Right |
Shift-F3 | s-F3 | Scroll Up |
Shift-F4 | s-F4 | Scroll Down |
Shift-F5 | s-F5 | CentreLine |
Shift-F6 | s-F6 | Nop |
Shift-F7 | s-F7 | Nop |
Shift-F8 | s-F8 | Nop |
Shift-F9 | s-F9 | Nop |
Shift-F10 | s-F10 | Nop |
Shift-F11 | s-F11 | Nop |
Shift-F12 | s-F12 | Nop |
Shift-Del | s-Del | Nop |
Shift-Down | s-Down | Mark Extend Down |
Shift-End | s-End | Mark Eol |
Shift-Home | s-Home | Mark Col1 |
Shift-Ins | s-Ins | Nop |
Shift-Left | s-Left | Mark Extend Left |
Shift-Page Down | s-PgDn | Nop |
Shift-Page Up | s-PgUp | Nop |
Shift-Right | s-Right | Mark Extend Right |
Shift-Tab | BackTab | BackTab |
Shift-Up | s-Up | Mark Extend Up |
Ctrl-A | c-A | Exclude Area |
Ctrl-B | c-B | Bookmark Set |
Ctrl-C | c-C | Comment_style |
Ctrl-D | c-D | DelWord |
Ctrl-E | c-E | EraseEOL |
Ctrl-F | c-F | Repeat_find |
Ctrl-G | c-G | Bookmark Go |
Ctrl-H | c-H | Nop |
Ctrl-I | c-I | Nop |
Ctrl-K | c-K | CopyLine |
Ctrl-L | c-L | CopyToCmd |
Ctrl-M | c-M | Nop |
Ctrl-N | c-N | Errors Next |
Ctrl-O | c-O | Errors Remove |
Ctrl-P | c-P | Openfile |
Ctrl-Q | c-Q | Nop |
Ctrl-R | c-R | Keys_record |
Ctrl-S | c-S | Shadow |
Ctrl-T | c-T | Keys_play |
Ctrl-U | c-U | All |
Ctrl-V | c-V | Reverse_find |
Ctrl-W | c-W | Find_word |
Ctrl-X | c-X | Exclude Toggle |
Ctrl-Y | c-Y | Match |
Ctrl-Z | c-Z | Nop |
Ctrl-F1 | c-F1 | Nop |
Ctrl-F2 | c-F2 | Nop |
Ctrl-F3 | c-F3 | Mark Upper |
Ctrl-F4 | c-F4 | Mark Lower |
Ctrl-F5 | c-F5 | Mark Mixed |
Ctrl-F6 | c-F6 | Nop |
Ctrl-F7 | c-F7 | Mark Shift Left |
Ctrl-F8 | c-F8 | Mark Shift Right |
Ctrl-F9 | c-F9 | Date Long |
Ctrl-F10 | c-F10 | CaseWord |
Ctrl-F11 | c-F11 | FuncWin |
Ctrl-F12 | c-F12 | RingWin |
Ctrl-Del | c-Del | DelWord |
Ctrl-Down | c-Down | CaseChar Lower |
Ctrl-End | c-End | Bottom |
Ctrl-Enter | c-Enter | Input |
Ctrl-Home | c-Home | Top |
Ctrl-Ins | c-Ins | Nop |
Ctrl-Left | c-Left | Previous_word |
Ctrl-Page Down | c-PgDn | BottomScreen |
Ctrl-Page Up | c-PgUp | TopScreen |
Ctrl-Right | c-Right | Next_word |
Ctrl-Tab | c-Tab | Nop |
Ctrl-Up | c-Up | CaseChar Upper |
Ctrl-[ | c-[ | Nop |
Ctrl-] | c-] | Nop |
Alt-A | a-A | Mark Area |
Alt-B | a-B | Mark Block |
Alt-C | a-C | Mark Copy |
Alt-D | a-D | Mark Delete |
Alt-E | a-E | Cursor EndMark |
Alt-F | a-F | Mark Fill |
Alt-G | a-G | Nop |
Alt-H | a-H | Hex |
Alt-I | a-I | Mark Integers |
Alt-J | a-J | Join |
Alt-K | a-K | Nop |
Alt-L | a-L | Mark Line |
Alt-M | a-M | Mark Move |
Alt-N | a-N | Keyin_name |
Alt-O | a-O | Mark Overlay |
Alt-P | a-P | Reformat |
Alt-Q | a-Q | Errors Show |
Alt-R | a-R | Mark Align |
Alt-S | a-S | Split |
Alt-T | a-T | CentreText |
Alt-U | a-U | Mark Clear |
Alt-V | a-V | Mark Vertical |
Alt-W | a-W | Mark Word |
Alt-X | a-X | ASCII |
Alt-Y | a-Y | Cursor BegMark |
Alt-Z | a-Z | Mark EOL |
Alt-1 | a-1 | Keyin À |
Alt-2 | a-2 | Keyin Á |
Alt-3 | a-3 | Keyin Ù |
Alt-4 | a-4 | Keyin à |
Alt-5 | a-5 | Keyin Å |
Alt-6 | a-6 | Keyin ´ |
Alt-7 | a-7 | Commentline Empty |
Alt-8 | a-8 | Commentline Full |
Alt-9 | a-9 | Keyin ¿ |
Alt-0 | a-0 | Input #if 0 |
Alt-F1 | a-F1 | Nop |
Alt-F2 | a-F2 | Compare |
Alt-F3 | a-F3 | Compare Sync |
Alt-F4 | a-F4 | Compare Merge |
Alt-F5 | a-F5 | Nop |
Alt-F6 | a-F6 | Nop |
Alt-F7 | a-F7 | Nop |
Alt-F8 | a-F8 | Nop |
Alt-F9 | a-F9 | Date Ordered |
Alt-F10 | a-F10 | Nop |
Alt-F11 | a-F11 | Nop |
Alt-F12 | a-F12 | Nop |
Alt-- | a-- | Keyin Ä |
Alt-= | a-= | Expand |
Alt-Down | a-Down | BottomScreen |
Alt-End | a-End | Next_para |
Alt-Home | a-Home | Previous_para |
Alt-Left | a-Left | Previous_sym |
Alt-Right | a-Right | Next_sym |
Alt-Up | a-Up | TopScreen |
Alt-[ | a-[ | Nop |
Alt-\ | a-\ | Keyin ³ |
Alt-] | a-] | Nop |
The profile may be used to change the
colours
used to display practically
every area of the X2 Editor screen. Under Unix systems the base
X-Windows colours
themselves may be remapped to different values.
Screen colour areas can be remapped with the following sequence:
where:
The available colours for use in either the foreground or the
background are
Black, Blue, Brown, Cyan,
Dark Grey*, Green, Light Blue*,
Light Cyan*, Light Green*, Light Grey,
Light Magenta*, Light Red*, Magenta,
Red, White*, and Yellow*.
The special foreground colour Reverse is only applicable when
areaname is equal to popup_cursor or
csr_line, and indicates that the popup window cursor should be
displayed using the reverse of the normal colour attributes for the
window. The table below
defines the various screen areas and their default colours.
* The colours marked with an asterisk may cause a blinking display when
switching to OS/2's window list and back, if they are assigned as a
foreground colour. If this occurs, the blinking may be removed by issuing
the REFRESH command.
Colour Remapping
COLOUR areaname = fg ON bg
Area Name | Meaning | Default Foreground | Default Background |
---|---|---|---|
alt_keywords | The colour used to highlight alternate user keywords | Yellow | Black |
browse_data | File text for a read only file | Green | Light Grey |
browse_ind | Ins/Brw indicator text for a read only file | Blue | Light Grey |
command | Popup command line | Blue | Cyan |
command_stack | Popup command stack | Blue | Cyan |
comment | The colour used to distinguish comments from normal text or code | Blue | Light Grey |
csr_line | The colour used to display regular data on the current cursor line. If set to Reverse, the normal colours of the cursor line will be reversed. If explicitly set to a colour, only the data area of the current line will be changed. | Black | Light Grey |
data | Normal text data | Black | Light Grey |
error_line | Compiler error information lines | Magenta | Light Grey |
filename | The colour used to display the filename on the left of the top screen row, when the file has not been changed. | Magenta | Light Grey |
function_name | The colour used to display the name of a function that has been recognised through the function_id profile setting. | Magenta | Light Grey |
highlight | The colour used to highlight the results of a Find command | Yellow | Magenta |
keywords | The colour used to highlight user keywords | Red | Light Grey |
mark | Marked area | Light Grey | Black |
message | The colour used for messages which will be written over the help line from time to time | White | Light Grey |
mod_filename | The colour used to display the filename on the left of the top screen row, when the file has been altered. | Light Red | Light Grey |
pfline | The PF display line on the bottom row of the screen | Black | Light Grey |
popup_cursor | The colour used to highlight the cursor line when a popup window is active. The special value Reverse indicates that the normal uncursored colour scheme will be reversed to highlight the cursor. | Reverse | |
prompt | The colour used to display prompt windows. | Yellow | Black |
prompt_input | The colour used to display the input text area of prompt windows. | Black | Yellow |
protected | The colour used to display protected fields (see LINEFIELDS for details on setting protected fields). | Green | Light Grey |
quotes | The colour used to highlight strings delimited with double quotation marks ("). Only the first quoted string on a line will be highlighted. | Brown | Light Grey |
shadow | The shadow line used to indicate one or more hidden file lines | Light Blue | Light Grey |
shadow_cursor | Cursor position in data area when cursor is on the command line | Black | Cyan |
status | Status area on top row of the screen. Contains indicators for the cursor row and column number, file size, insert/replace status, and hexadecimal value of the current character. | Blue | Light Grey |
tofeof | The colour used to draw the Top of File and End of File lines | Black | Light Grey |
window_bold | Bold popup window lines. Used for lines highlighted with bold emphasis (see WINLINE). | Black | Cyan |
window_data | Normal popup window lines. Used for lines highlighted with text emphasis (see WINLINE). | Blue | Cyan |
window_ emphasis | Emphasised popup window lines. Used for showing modified files in the Ring popup window, and for emphasised lines (see WINLINE). | Light Red | Cyan |
window_title | Popup window title line. Used for displaying the popup window title line. (see WINDOW). | Yellow | Magenta |
xwindows_cursor | The colour used to draw the cursor under the X-Windows versions. This colour is only applicable to the X-Windows versions on Linux and AIX. Only the foreground colour is used, even though both foreground and background colours must be specified. | Red | Light Grey |
On Unix X-Windows systems, the mappings of the base screen colours may be changed from their defaults.
X-COLOUR colour = xcolour
where:
The available values for colour are the same as the
foreground and background colours for the
Colour Remapping
profile setting.
The table below
defines the default X-Windows colours for each colour.
Colour | Default X-Windows Colour |
---|---|
Black | black |
Blue | DarkSlateBlue |
Brown | brown |
Cyan | cyan |
Dark Grey | DarkSlateGrey |
Green | green |
Light Blue | Blue |
Light Cyan | LightCyan4 |
Light Green | LightSeaGreen |
Light Grey | LightGrey |
Light Magenta | magenta |
Light Red | red |
Magenta | magenta4 |
Red | red4 |
White | white |
Yellow | yellow |
There are places in the X2 Editor where the default strings may be overridden by user-defined strings. This may be required so the string accurately describes the configuration, or the user may simply prefer some other text. String definition lines in the profile are formatted as follows:
STRING str = text
where text is the text to be displayed. Quotation marks are
optional but recommended. Either single quotes (') or double quotes
(") may be used. The identifier str can be any one of the
following:
The X2 Editor provides the ability to define user exits for internal
commands.
Synonym lines have the following syntax:
where:
Some example uses of synonyms:
Used to download a file from the host before loading it into the editor,
if the filespec matches a predetermined format, and to upload the file again
when it is saved to disk.
Used to change the screen size to contain 32 rows while in the editor, and
to restore it to 25 rows when the edit session is ended.
The Ctrl-Y key is set to match pairs of brackets. Brackets may be defined
with the brackets keyword, as follows:
where o1 and c1 define the opening and closing
string for the first bracket pair, and o2 and c2
define the second bracket pair. As many brackets as desired may be entered,
but they must come in pairs. Bracket strings may be as long as desired. For
example, "#if,#endif;" would be a valid pair of "brackets". Only one
brackets line is allowed in the user profile.
To use either a comma or semi-colon as part of the brackets string,
insert a backslash immediately before the character.
In addition to user defined matching characters, X2 does special matching
for highlighted tags and conditional
strings. See
MATCH
for further information.
This section describes settings which are global to every file in the
ring. These settings may be changed once the editor is active, but they
define the initial state for each setting.
The X2 Editor recognises any combination of carriage return (CR) and line
feed (LF) characters to denote the end of a line. When it reads a file from
disk, it remembers which combination of newline characters were used to
delimit the line. For newly inserted lines, it will use the combination it
finds in the first line of the file. For newly created files,
it will use both CR and LF as the newline marker. This may be changed to
just LF with the following profile line:
The normal cursor size is an underline bar to represent Replace mode,
and a medium rectangle to represent Insert mode. If you find the cursor
difficult to see with these defaults, you may want to adjust the
sizes to suit your taste. The Insert mode and Replace mode cursor
sizes may be changed in the profile:
size1 and size2 may be either of SMALL,
MEDIUM, and LARGE.
X2 provides the capability to save editor information with a file when it
is saved to disk. It does this by writing the cursor position and other data
to an extended attribute (EA) for the file. By default this capability is
turned on, but you may turn it off in the profile with the following line:
By default, if the cursor is in the file the Enter key will always
move the cursor to the first non-blank character on the next line. If you
want Enter to move to the new line when Insert mode is off, but insert a new
line when Insert mode is on, add the following line to your user profile:
When the cursor is at the last line of a file, and ENTER_INSERT is OFF, or
Insert mode is off, pressing the Enter key will not move the cursor. You can
make the Enter key insert a new line in this circumstance with the following
profile line:
The default setting for insert mode is OFF. To start the editor with
insert ON, insert the following line in the user profile:
Normally, when the editor is in replace mode, the cursor is displayed as a
thin line on the bottom of the line. When insert mode is ON, the cursor
takes up half the distance from the bottom of the line to the bottom of the
previous line (the cell height). If you find it hard to see these
cursors, you may enlarge them with the following statement in the profile:
This will cause the replace cursor to take up half the cell height, and
the insert cursor will take up the full cell height.
The Tab key normally moves the cursor to the next tab position, but when
Insert mode is on, it will insert spaces to the next tab position. To cause
it to always move the cursor without inserting spaces,
add the following line to your profile:
By default the LINEND setting is ON, but it can be turned off through the
profile:
When displaying a popup window or the popup command stack, the up and down
cursor keys are used to scroll through the list. The default editor will
stop scrolling if you press the down key while at the bottom of the list, or
the up key when at the top of the list. If you want the window to wrap
around from the top to the bottom and vice versa, add the following line to
your user profile:
The bookmark feature may be set to utilise multiple bookmarks for each
file. If this has been done, a popup window will be displayed when a
bookmark is to be set. A quicker way is to have the bookmarks
pushed down like a stack, and have the new bookmark added to the
topmost position. This is accomplished by setting the quickmarks
profile option:
The default setting for the status line is ON. To start the editor with
STATUS OFF, the status command must be placed in the user
profile:
The X2 Editor provides the capability to automatically generate a bookmark
whenever the cursor jumps a long way. A profile setting is provided to
allow you to specify how many of these special bookmarks are to be saved, and
the minimum number of rows that the cursor has to move before the bookmark is
triggered. Automatic bookmarks are displayed for selection with the
AUTOBOOKMARK
command, which is not defined to a default key.
The following command is used to set up automatic bookmarks:
Where n specifies the maximum number of auto bookmarks that are
to be saved, and m is the minimum number of lines to trigger the
bookmark.
As an example, auto_bookmarks could be set to 15,50 which means you have
up to 15 special bookmarks, which are set whenever you issue a command that
causes your cursor to jump more than 50 lines. If you pressed ctrl-home your
last cursor position would be automatically saved, and issuing the
autobookmark command would allow you to recover your cursor position from
before pressing ctrl-home.
By default this option is set to 0,0 which disables it.
By default, the X2 Editor will provide a single bookmark setting. This
allows you to quickly set a bookmark with Ctrl-B and go to that saved
position with Ctrl-G. If you want more than one bookmark, you can
increase the number of bookmarks with the following command:
If you select more than one bookmark, you will be prompted for the
bookmark whenever you press Ctrl-B or Ctrl-G.
When the Escape key is pressed a command line is displayed at the top of
the screen, and the command stack is displayed immediately below this. To
change the location of the command line to the bottom of the screen, with the
command stack immediately above it, use this profile command:
When you display the command line with the escape key, a window is
displayed which shows previously entered commands. By default, this window
is ten rows deep and 30 columns wide; however, it may be set to any number of
rows between zero and twenty and any number of columns with the following
profile commands:
If a file is specified with no extension, and it is not found on disk, a
search may be made for one or more default extensions. If a file
with the default extension is found, it will be loaded instead of the file
without the extension. By default no default extension processing will be
performed, but this capability may be turned on by defining a
DEFAULT_EXT line in the profile:
If a file is specified without an extension, and it doesn't already exist
on disk, the supplied extensions will be tried, one at a time. The first one
that results in a matching file will be used as the file to be edited. If
all default extensions are tried without a successful match, the originally
specified file specification will be used.
For example, let's say that the default_ext string is set
to C,H,CMD, and that the filename TEST is specified on
the command line. X2 will load the first file found from the following
list:
If none of the above files exist on disk, a new file called
TEST will be loaded into the ring.
If the editor is started without a file specified on the command line, it
will load an empty file with no name. You can customise it so it will load
files from a list, by setting the DEFAULT_LIST in your profile:
The format of fn is one file per line - the text on each
line will be treated as a file to be loaded. Lines that begin with an
asterisk (*) will be treated as comments and ignored.
If the default list is specified but not found, it will be edited instead of
an unnamed file. This allows you to easily create the default list file,
which is probably unique for each directory on your system.
The escape character is used when displaying popup windows to control the
emphasis of the text in a WINLINE. It is followed by various characters to
create text with Bold, emphasised, or normal text.
WINLINE
contains more information on how to use the escape character when building
popup window lines.
The default escape character is a backwards quote (`) symbol. To
change it to another character, insert the following line in the user profile:
When the tab key is pressed from the command line, the last word on the
command line is expanded to find all matching filenames. By default, if more
than one match is found a popup window will show all the matches for user
selection. This behaviour may be tailored by setting a threshold in the
profile as follows:
This will cause the matching filenames to be displayed on the command line
in response to successive presses of the tab key, if the number of matches
found is less than or equal to n. If more than n
matches are found the popup will still be used.
The default linend character is the caret (^) symbol. To change it
to another character, insert the following line in the user profile:
The null character is used in place of x'00' characters when displaying a
file in text mode. The default null character is the question mark (?)
symbol, but it can be changed to another character with a line like the
following in the user profile:
The default OpenFile function will look for a file in the
current directory. If you would prefer it to scan directories that have been
defined by environment variables, you may set the various paths with the
PATHS statement:
The paths defines a set of environment variables, where each
variable may be separated by a space or semi-colon. For example,
paths may be set to INCLUDE;PATH. In this case, all
the paths defined by INCLUDE will be searched for the file, followed by all
the paths specified by PATH.
This statement has no effect in the DOS version.
Controls the available responses when the QUIT command is issued for a
modified file. By default, the characters Y, N, and W and any keys that have
been set to the FILE, SAVE, or QUIT commands are acceptable responses. To
bypass the function key check so that only the characters Y, N, and W will be
accepted,
set this option to "charonly":
Some NLS Windows keyboards don't automatically distinguish the right alt
key as an AltGr key. If you are using an NLS keyboard and the right alt key
is not giving different results from the left, you probably need to tell X2
to treat right alt as AltGr:
Note that this setting will have no effect if you are using any version
except the Windows version.
When the user shells to a command prompt with the
SHELL
command, it can
sometimes be easy to forget that the editor is still active. An indicator is
added to the default prompt string to act as a reminder. By default this
string is "(x)", but it can be changed with:
where str will be prefixed to the default prompt string for all
SHELL commands.
The only time the default editor beeps is when the /ERR
option is supplied on the command line. If you like to hear a beep when
the editor wraps around a file during text searches, add the following to
your profile:
The X-Windows (AIX) version of the editor uses graphics routines to draw
its window; therefore, the font it uses may be customised. The default font
is "fixed", but it may be changed with the XWINDOWS_FONT profile line:
To find which fonts are installed on your system, go to directory
/usr/lpp/X11.fnt and look at the files with extension .inventory.
It is sometimes handy to customise the editor settings by disk. For
example, when an OS/2 mounted disk is really resident on an AIX system, it
would be nice to automatically save files with blanks compressed into tab
characters.
Keywords are available to alter the editor settings based on the disk
letter. The settings available may be found in
User Profile Disk Customisation.
Customisations are often required for specific file types. File types are
recognised in one of three ways:
The file extension is defined to be everything after the last
period (.) in a file name. If it matches a supplied extension, profile
customisation for that extension will be used.
A file pattern may be defined in the profile for cases where a
file has no extension, or where the portion before the period is more
suitable for categorising files. Wildcards may be used in file patterns.
An example of this method of typing a file comes from
xprofile.def:
If the above two tests have failed to provide a match, the first line of
the file is examined for a shell extension. If the first two characters of
the line consist of "#!", the text after the last file separator (slash on
Unix systems, backslash otherwise), is used to search for profile
customisation. For example, if the first line of a file reads
#!/usr/bin/perl, then the file "extension" is assumed to be
perl. This feature is most useful on Unix systems, but is
available in all versions except for the DOS version.
A series of keywords is available to set the file
extension, and to specify comment formatting and syntax expansion parameters
for that file type. Each has the syntax "keyword = text", where
keyword and text are defined in
User Profile Extension Customisation.
If desired, you can override the system defaults for various
extension-specific settings. This is done by specifying a default filetype
of *. This will be used if no other matching filetype is found
for a file. For other extensions which are defined after the default
extension in the profile, the values defined for the default extension will
be the initial values for the definition.
Note that changes
to the default file extension of * will only affect file extensions that are
undefined or defined later in the sequence.
Comment formatting is an important part of the X2 Editor. The formatting
of inline comments can be controlled through the
comment_formatting keyword in the user profile. This line has the
following format:
The following flags are available:
For most programming languages, the default of FALSE will be desired.
Assembly language is the most likely candidate for a setting of TRUE.
Note that all the formatting flags must be written on a single line, and
that all the flags are re-set to their default values whenever a new
comment_formatting profile line is encountered. Only one of the LEFT, RIGHT,
C_CONDITIONAL, and CPP_CONDITIONAL flags may be specified for any file
extension.
When viewing a file containing source code, the Ctrl-F11 key may be used
to display a window containing a list of each function defined in the current
file. The list will be sorted alphabetically by function name, and the
current function (if available) is selected. Function recognition is set up
through the
function_id
keyword in the user profile. This keyword
has the following format:
where:
Function recognition can be set up for any language; however, it is mainly
intended for use with the
C, C++, Rexx, NetRexx, SCRIPT, and ASM languages.
The rules for identifying functions in various programming languages
differ widely, making the required profile code sometimes quite complicated.
A few examples will hopefully illustrate the purpose behind some of the above
flags and parameters.
The first example is commonly used when parsing Rexx source code. It says
that if the first word on the line ends with a colon character, it is a
function definition line. The name offset of -1 tells the editor to treat
the first word before the colon as the function name.
In the next example, we're using the function recognition a bit
differently; we again want to highlight lines in which the first word ends in
a colon, but this time we want to exclude those lines in which the first word
also contains a right parenthesis. The start line offset of 0 means to start
the Cancel scan at the current line, i.e. the line that has
tentatively been flagged as a function. Adding maxlines of 0 means we only
want to scan the current line before we stop searching.
The following example is used to scan X2 Editor profile definition files.
There are two possible triggers for a "function" - the first word on the line
may be either "extension" or "file_pattern". If found, the actual function
name is considered to be two words after this text, and could contain the
special characters '.', '*', and ',' in addition to the normal alphanumeric
characters.
Our next example is starting to get more complicated, and is used for
parsing Java source files. As part of the profile processing we have chosen
to extend the base "C" filetype, but we want to handle functions separately.
So we start the function id processing with the _RESET keyword,
which clears all previous definitions. We then specify that any line that
contains a semi-colon in any position, is to be ignored. If we
didn't do this, then any function call would be flagged as a function
definition, which is obviously not what we want. We then specify
that any line containing either the word "class" or a left parenthesis is
maybe a function - we have also required that it be followed by a
left brace in either column 1 or column 3, up to 15 lines from the line in
which the special text was found. We've also told the editor that if we find
a right brace in column 3, before we find the left brace, then we
don't want a function. The NO_DUPES flag on the left parenthesis
specification, means that we must find a left brace before we find
another left parenthesis; otherwise, no function.
The standard processing for C source files is very complicated, which
reflects the free coding format that is allowed by the C language. We start
by specifying that any line that begins with a hash symbol or contains a
semi-colon is to be ignored. This covers pre-processor statements (#include)
and function calls. We now have three "trigger" strings to flag a function
line, and two strings which may cancel the function identification. These
are similar in form and function as for the Java processing described above.
The above sample is good for identifying functions in C source code, where
the opening and closing braces are always in column one of the file. Some
people prefer to write C code with the opening brace following the function
definition, e.g.
This code is more difficult to parse, but the following profile
definitions may help:
Our last example is the definition for C++ files. As C++ is simply an
extension of the C language, we'll want to include all the C function
recognition statements, with a few extensions of our own. In order to handle
constructors we need to check for a colon in word number one of the following
15 lines. If we didn't include this check, constructors that called other
initialisers would fail our checking, as a left parenthesis would be found
before the left brace. Note that we wish to include the colon and tilde
characters in our list of function name characters, to handle member
functions and destructor functions respectively.
X2 provides the ability to automatically expand keywords into additional
text. This provides a handy way to reduce typing and syntax errors. Every
time the space bar is pressed, a check is made on the line text against user
defined syntax triggers. If a trigger is found, the specified replacement
text is entered, and the cursor re-positioned. Insert mode is always
set to allow continued typing. Syntax expansion is defined in the user
profile, with the following keywords:
If desired, multiple keywords may be specified in text by
separating them with commas. For example, the line "expand_keyword =
kw,keyword" will expand with expand_replace or
expand_macro if either kw or
keyword is found on the line. To include a comma in the keyword
text, prefix it with a backslash.
Besides "\1" and "\c", special substitution variables may
be included in expand_replace strings, as defined in the following
table. Note that each variable identification character is case
sensitive.
Many programming languages include some sort of preprocessor statement to
conditionally include blocks of code. For example, the C language compilers
provide the #if, #elif, #else, and
#endif directives. The X2 Editor supports these constructs through
the conditionals keyword, which has the format str1, str2,
str3, ..., strM, strN. These strings are used with the
CONDITIONAL and MATCH commands.
The CONDITIONAL command can take one of three parameters:
IF, ELSE, or END. With the IF
parameter the first conditional string, i.e. str1, will be input
into the current file. With the END parameter, the last string
(strN) will be input. If the ELSE parameter is
specified, the second last (strM) parameter is input
into the file.
The MATCH command takes no parameters. If the cursor is on
str1 the cursor will be moved to the next occurrence of
any of str2 through strN. If the cursor is
on strN it will be moved to the previous occurrence of
str1. If it is located on any of str2 through
strM, it will be moved to the next occurrence of
any of str2 through strN.
The MATCH command will recognise strings other than
conditionals. If
brackets
have been defined and the cursor is positioned on one of these strings, the
cursor will be moved to the equivalent bracket.
Repeated invocations will
toggle the cursor between the open and close bracket string. If the cursor
is positioned on a colon (:) character, it is assumed to represent the
start of a GML tag. If the next character is the letter E, a backwards scan
will be made for the tag. "Tags" that may be found inside comments or quoted
strings are ignored for the purpose of the match command.
The X2 Editor provides a key (Ctrl-P in the default configuration) that is
used to open a file based on information on the current line. By default, it
looks for the first text on the line that contains valid filename characters
and uses that; however, the default behaviour may be extended by filetype
through the user profile. For any extension one or more
openfile_id entries may be defined, with the following
format:
where:
The editor has the capability of re-formatting source code files according
to pre-specified rules. This is useful when viewing someone else's source
code - it is much easier to concentrate on the content of the code when the
coding style is familiar and not distracting. Style formatting is not
intended to be perfect; rules may be specified which formats most code so it
is close to the desired output, but it is almost impossible to get all code
to format perfectly. Still, it is a useful function that can assist in the
review of source code files.
Style formatting is set up for a file extension in the user profile.
The format of style formatting lines is:
where keyword is a keyword that, if found at the beginning of
a file line, will cause succeeding line(s) to be formatted according to the
specified flags. Specify a keyword of _RESET to clear
previously defined style keywords.
Flags can be:
Note the style formatting uses the utilities DLL and is unsupported in the
DOS version.
Synonyms
SYNONYM syn = MACRO macroname <parms>
synonym edit = macro hostedit edit
synonym save = macro hostedit save
synonym startup = shell mode co80,32
synonym exit = shell mode co80,25
Bracket Matching Characters
BRACKETS = "o1,c1;o2,c2; ..."
Initial Editor Settings
Newline Character
DEFAULT_NEWLINE = LF
Cursor Size
CURSOR_INSERT = size1
CURSOR_REPLACE = size2
Saving Editor Information
EA = OFF
Enter Key Behaviour
ENTER_INSERT = ON
INSERT_EOF = ON
Insert Mode
INSERT = ON
BIGCURSOR = ON
TAB_INSERT = OFF
Linend Setting
LINEND = OFF
Popup Window Scrolling
POPUP_WRAP = ON
Quick Bookmark Setting
QUICKMARKS = ON
Status Line
STATUS = OFF
Automatic Bookmarks
AUTO_BOOKMARKS = n,m
Multiple Bookmarks
BOOKMARKS = n
Command Line Location
CMDLINE = BOTTOM
Command Stack Window Size
CMD_WINDOWSIZE = n
CMD_WINDOWWIDTH = m
Default Extension
DEFAULT_EXT = ext1,ext2,ext3,...
Default List
DEFAULT_LIST = fn
Escape Character
ESCAPE_CHAR = c
Filename Completion Threshold
fn_completion = n
Linend Character
LINEND_CHAR = c
Null Character
NULL_CHAR = c
OpenFile Paths
PATHS = paths
Quit Response When File Modified
quit_modresponse = charonly
Right Alt (AltGr) Key
right_alt_is_altgr = on
Shell Prompt String
SHELL_PROMPT = "str"
Beep Behaviour
WRAP_BEEP = ON
X-Windows Font
XWINDOWS_FONT = "newfont"
Disk Specific Customisation
User Profile Disk Customisation
Keyword Text Default Meaning
disk
disk1,disk2,...
N/A
Defines a list of disks for which the following definition(s) apply.
There is a maximum of 27 disk letters that may be defined.
The special disk * may be used to set disk settings for all disks.
disk_ea
ON | OFF
ON
Controls saving of file information with a file as extended attributes
(EAs). ON saves the information, OFF discards it.
Overridden by the EA command.
disk_linend
CR | LF | CRLF | ASIS
ASIS
Defines the desired linend character(s) to be used when saving a file.
Each line may be terminated with a Carriage Return, a Line Feed, or the two
together. The default value of ASIS means that lines should be
saved with the same termination character as they had when they were read.
disk_tabs
ON | OFF | ASIS
ASIS
Allows file lines to be saved with multiple occurrences of blanks
compressed into tab characters. The default value saves lines with no tab
compression, which improves performance but increases the amount of disk
space required to save the file.
File Extension Specific Customisation
file_pattern = xprofile.*
Default Extension
Inline Comment Formatting Control
comment_formatting = flag1 | flag2 | flag3... | flagN;
Code Functions List
function_id = "keyword", flags, <WORDNUM=w,> <STARTLINE=s,> <MAXLINES=m,>
<COLUMN=c< &|- c2,>> <NAME_OFFSET=n>;
Function Identification Examples
function_id = ":", END_OF_WORD, WORDNUM=1, NAME_OFFSET=-1;
function_id = ":", END_OF_WORD, WORDNUM=1, NAME_OFFSET=-1;
function_id = ")", CANCEL, STARTLINE=0, MAXLINES=0, WORDNUM=1;
funcname_chars = ".*,";
function_id = "extension", REQUIRED_SET, WORDNUM=1, NAME_OFFSET=2;
function_id = "file_pattern", REQUIRED_SET, WORDNUM=1, NAME_OFFSET=2;
base_extension = C
function_id = _RESET;
function_id = ";", IGNORE;
function_id = "CLASS", REQUIRED_SET, NAME_OFFSET=1;
function_id = "(", REQUIRED_SET | NO_DUPES, NAME_OFFSET=-1;
function_id = "{", REQUIRED, MAXLINES=15, COLUMN=1&3;
function_id = "}", CANCEL, MAXLINES=15, COLUMN=3;
function_id = "#", START_OF_WORD | IGNORE, WORDNUM=1;
function_id = ";", IGNORE;
function_id = " STRUCT ", REQUIRED_SET, NAME_OFFSET=1;
function_id = "CLASS", REQUIRED_SET, NAME_OFFSET=1, WORDNUM=1;
function_id = "(", REQUIRED_SET | NO_DUPES, NAME_OFFSET=-1;
function_id = "{", REQUIRED, MAXLINES=15, COLUMN=1;
function_id = "}", CANCEL, MAXLINES=15, COLUMN=1;
function_id = ");", CANCEL, MAXLINES=15, COLUMN=1;
int main (int argc, char *argv[]) {
...
}
function_id = _RESET
function_id = "#", START_OF_WORD | IGNORE, WORDNUM=1;
function_id = ";", IGNORE;
function_id = " STRUCT ", REQUIRED_SET, NAME_OFFSET=1;
function_id = "CLASS", REQUIRED_SET, NAME_OFFSET=1, WORDNUM=1;
function_id = "}", MATCH, COLUMN=1;
function_id = ")", PREVIOUS | MATCH, NAME_OFFSET=-1;
base_extension = C
funcname_chars = ":~";
function_id = ":", OPTIONAL, WORDNUM=1, MAXLINES=15;
Syntax Expansion
Variable Meaning
\\ Escape, replaced with \
\1 Substitution variable
\B Full written month, e.g. February
\c Cursor placement
\CP The currently defined comment prefix string
\CS The currently defined comment suffix string
\d 2 digit day number, e.g. 06
\D Day number, e.g. 6
\f Unqualified filename, e.g. cdPlayer.ini
\F Fully qualified filename, e.g.
C:\WINDOWS\cdPlayer.ini
\H Hour of the day, 24 hour clock
\m 2 digit month number, e.g. 02
\M Minute of the hour, e.g. 09
\S Second of the minute, e.g. 03
\y 2 digit year number, e.g. 00
\Y 4 digit year number, e.g. 2000
Conditional Strings
Customising the OpenFile Function
openfile_id = "keyword", WORDNUM=w, <PATH=p,> <NO_BLANKS,>
<PATHSEARCH=ps,> <DEFAULT_EXT=xxx>;
Style Formatting
styleword = keyword, flag1 | flag2 | ... flagN;
User Profile Extension Customisation
Keyword Text Default Meaning
extension
ext1,ext2,...
N/A
Defines a list of extensions for which the following definition(s) apply.
Up to 50 file extensions may be defined in the entire profile.
If ext1 is * the following information is
taken to be the default for any file extension.
The supplied list may represent either operating system file extensions or VM
host filetypes.
file_pattern
ext1,ext2,...
N/A
A synonym for the extension keyword,
which is more meaningful when one or more of the
"extensions" represent a full filename. If a filename is required in the
list, it must be followed by a dot (.), even if it has no extension.
a-pfline
"text"
" 2=Comp 3=Sync 4=Merge 9=MDY "
The text to display on the bottom line of the screen when either
Alt key has been pressed and held down.
alt_highlight
_kw
word1,word2,...
_RESET
Defines an alternate set of keywords which should be highlighted on the
screen with the ALT_KEYWORDS colour. Refer to
Keyword Highlighting
for details.
APIFile
<d:\path\>
fn.ext
""
Defines the file which contains a list of API expansion text. Required to
turn on the API Expansion feature. If no path information is specified, the
file is assumed to be in the directory specified in the XPATH
if available, or in the current directory if not.
autosave
n
0
Defines the number of alterations that can be made to the file before it
is automatically saved to disk.
base_extension
extname
"*"
Identifies the previously defined extension data that should be used as
the initial data for the current extension. This statement should be located
immediately after the extension keyword.
c-pfline
"text"
" 3=UC/m 4=LC/m 5=MC/m 7=ShLf 8=ShRt 9=YMD 10=C/Wd 11=Fnc 12=Rng"
The text to display on the bottom line of the screen when either
Ctrl key has been pressed and held down.
code_indent
n
2
Defines the number of spaces to indent code on a new line.
This value will only be used if the cursor is being moved to a blank line and
the first or last character on the previous line is a left brace ({)
character.
code_type
text
NONE
Identifies the type of source code contained in the file. Any text is
valid.
comment_
anycolumn
true/false
true
Controls whether a comment may be located in any column in the file, or
must be located in the
comment_column column.
comment_column
nn<,t>
40,8
Controls the formatting of inline comments. By default, inline comments
that are to be left-aligned will be formatted so that the beginning of
the comment is located in column 40 of the file. This option allows
you to change that column to nn.
If the code portion of a line extends past column nn,
the comment will be aligned on the next available multiple of t
bytes.
comment_escape
c
""
If the comment_prefix string is prefixed by c, the
string is NOT treated as a comment but as part of the regular text.
comment_
formatting
Flag bits
none
Defines the initial formatting of comments. See
Inline Comment Formatting Control
for definitions of the various options.
comment_prefix
string
""
Defines the text which identifies the beginning of a comment. This text
is used when formatting comments. It also identifies a comment for
highlighting purposes. Note that some of the comment_formatting
flags control exactly how the comment_prefix is interpreted.
comment_suffix
string
""
Defines the text which identifies the end of a comment. Note that quotes
are only necessary if the text contains either leading or trailing
blanks.
conditional_prefix
string
""
Defines a string which identifies the beginning of a conditional string.
This string is used by the UPPERCASE option of the comment formatting
logic to bypass automatic code upper casing.
conditionals
str1,str2,...strN
"#if 0, #else, #endif"
Defines strings which are to be used with the CONDITIONAL
command to input conditional compilation IF, ELSE, and
END commands. These strings are also used for "bracket" matching;
for this function more than one str2 string may be specified; see
Conditional Strings.
end_blanks
on/off
off
When ON, allows trailing blanks to be added at the end of any line. The
blanks will be saved on disk as part of the line.
eof_text
text
"==== End Of File ===="
The text to be displayed to mark the end of the file data
expand_keyword
text
_RESET
Defines a syntax expansion keyword. See
Syntax Expansion
for details.
expand_macro
text N/A
Defines the name of a macro which will receive control when a syntax
expansion keyword is recognised. See
Syntax Expansion
for details.
expand_replace
text N/A
Defines a syntax expansion replacement line. See
Syntax Expansion
for details.
expand_tabs
on/off
on
Controls expansion of tab (hex 09) characters to blanks. When on, blanks
are inserted so that the column is moved to the next position that is an even
multiple of eight.
fieldtemplate
<c1 [U &vbar. P]> <c2 [U &vbar. P]> ...
""
Specifies a default field template which will be applicable to all lines
in the file. See
FIELDTEMPLATE
for more information on fieldtemplate settings.
findword_anycase
on/off
off
Allow finding the word under the cursor in mixed case with the
FIND_WORD
function. The default value of OFF forces an exact case search.
flowtonew
on/off
off
If ON, flowed text is inserted as a new line; if OFF, flowed text is
inserted at the beginning of the next line.
funcname_chars
"charlist"
""
Defines characters which are used in addition to the default set
(alphanumerics plus the underscore character) to recognise the beginning
and end of a function name in function recognition and highlighting.
function_header
true/false
false
If true, scrolling to the next or previous function will move
to possible header text above the actual header definition line. If set to
the default of false, function scrolling will move directly to the
function definition line.
function_id
"keyword", flags, <WORDNUM=w,> <STARTLINE=s,>
<MAXLINES=m,> <COLUMN=c <&c2>,>
<NAME_OFFSET =n,>
<NAME_LENGTH =l>;
_RESET
Defines keywords which are used by the editor to identify functions for a
given filetype. See
Code Functions List
for more information about the parameters.
helpfile
fn
""
Defines fn as an override to the default, globally defined help
file, for just the current filetype.
highlight
_keyword
word1,word2,...
_RESET
Defines keywords which should be highlighted on the screen with the
KEYWORDS colour. Refer to
Keyword Highlighting
for details.
highlight
_quotes
true/false
true
Specifies whether strings which are delimited by either single or double
quotation marks should be highlighted with the quotes colour.
highlight_tags
"prefix1, suffix1; prefix2, suffix2; ...prefixn, suffixn;"
""
Defines the beginning and ending text that identifies tags which are to be
highlighted. Any text on a line between prefixn and
suffixn will be highlighted with keywords emphasis.
Tag strings must come in pairs, and are separated by commas and semi-colons.
To use either a comma or semi-colon as part of a tag string, insert a
backslash immediately before the character. To really enter a backslash,
escape it by entering two backslashes in a row. To allow any alphabetic
character to be contained in a prefix string, use the special character
sequence "a-z".
indent_keywords
"kw1,kw2,...kwn"
""
Defines a set of comma-delimited words which cause the cursor to be
indented by the code_indent number of spaces, if it is moved to a
blank line and the previous line begins with one of the specified keywords.
input_keywords
"kw1,kw2,...kwn"
""
Defines a set of keywords, delimited by commas, which trigger the
input_macro if found at the beginning of a line when a new line is
input. This check is skipped if the INPUT command is issued from
within a macro.
input_macro
"macroname <parms>"
""
The name of the Rexx macro to be executed if a new line is added and the
current line begins with one of the input_keywords. The
indentation and the contents of the current line are supplied to the macro as
parameters.
key XX
command
varies
Defines the XX key to the specified command, for the current
file extension only. Usually used as an override to a default key.
keyword_case
exact/any
any
If exact, highlight keywords must be found exactly as typed to
be highlighted; if any, a case-insensitive search will be used to
find highlight keywords on a line.
keyword_trans
upper/lower/
mixed/AsIs
AsIs
Controls keyword translation. Possible values are UPPER,
lower, Mixed, and AsIs, where
AsIs is the default. Any changed lines containing words from
either the highlight_keyword or alt_highlight_kw lists
will have the keywords translated into the specified case.
margins
n1 n2 n3 n4
1 100 1 77
Defines formatting margins. n1 and n2 define
the left and
right text margins for auto-flow. n3 and n4
define the desired block comment margins.
openfile_id
"keyword", WORDNUM=w, <PATH=p,> <NO_BLANKS,>
<PATHSEARCH =ps,> <DEFAULT_EXT =xxx>;
_RESET
Defines keywords which are used to provide a filename for the OPENFILE
function. See
Customising the OpenFile Function
for more information about the parameters.
pfline
"text"
"F1=Hlp 2=SpJn 3=Quit 4=Sav 5=Nm 6=New 7=PgUp 8=PgDn 9=Undo 10=Redo 11=Prv 12=Nxt"
The text to display on the bottom line of the screen when no shift keys
are active.
quick_comment
string
""
A string which will be converted to
the defined comment_prefix and comment_suffix
strings. A commonly used quick_comment string is
//.
save_options
string
""
Provides default options to be used with the SAVE and FILE commands. Any
combination of valid save options may be specified, but command line options
will override these defaults.
s-pfline
"text"
"F1=ScrL 2=ScrR 3=ScrU 4=ScrD 5=CtrLnVrt"
The text to display on the bottom line of the screen when either Shift
key has been pressed and held down.
shadow
on/off
on
Sets the initial value of the SHADOW setting for this file type.
sort_funclist
on/off
on
Controls whether the function list popup window will be sorted.
split_align_paren
on/off
off
If set to ON, split new text will be aligned beneath an open parenthesis
from the previous line, if found.
styleword
keyword, flags
undefined
Sets a keyword and the formatting style for style formatting. See
Style Formatting
for details.
syntax
on/off
on
Sets the initial value of syntax assistance for this file type.
tabs
n1 <n2 n3 n4...> <,m>
8
Defines the initial tab stops. If n1 is the only number
specified, tabs will be set every n1 spaces, beginning in column
1. If the ,m parameter is specified, soft tab settings will
continue from the last hard tab stop specified, every m spaces.
Note that tab stops must be numeric and they must be specified in ascending
sequence. There is a limit of 31 hard tab settings for each file type.
tag_end
text
""
The string that indicates the end of a highlight_tag. For example, for
HTML markup, a beginning tag is indicated with <tag>, and the corresponding
ending tag is </tag>. For this filetype, the tag_end string will be "/".
tof_text
text
"==== Top Of File ===="
The text to be displayed to mark the beginning of the file data
undent_keywords
"kw1,kw2,...kwn"
""
Defines a set of comma-delimited words which cause the cursor to be
undented by the code_indent number of spaces, if it is moved to a
blank line and the previous line begins with one of the specified keywords.
undo_limit
N
-1
Maximum number of undo lines to save. -1 means save all changes until the
file is saved to disk. 0 means save no undo lines. N means save the
previous N changed lines, although this option is not yet implemented.
wrap
on/off
on
Sets the initial value of the WRAP setting for this file type.