Now you've tried this editor you should agree it is easy to use. However it can be configured to correspond better to what you expect. You can configure two things: the user interface and the general behaviour of the editor. All this configuration stuff can be made with variables placed in profile files or directly modified from the internal commands window. A key mapping is nothing more than a variable which name is the key name and a value which is the function, macro or text assigned to this variable. The syntax to set or modify a variable is:
VARIABLE_NAME:VARIABLE_VALUE
or if you are in the internal commands window:
:VARIABLE_NAME:VARIABLE_VALUE
Profile files are text files which contains variables names and values. You
can type comments too because each line which doesn't begin with a variable
name is considered to be a comment. In a near future JERED will be able to
read up to four profile files one after the other in order to allow people
to use a site specific profile,
then a user specific profile, then a project specific profile and finally
a site-specific-again profile in which the site's administrator could put
limitations on JERED's behaviour. In the package you've downloaded there is a
default profile file named profile.je
which in fact shows
the default values of all JERED's internal variables. It doesn't contain the
default values for the normal keys because everyone knows that
a 'A'
will produce a
'A'
, however normal keys are redefinable too.
You can use or modify this profile file to learn how to configure JERED.
This default profile includes all the possibilities and constants's names you
can use in a JERED profile file, describing most of them.
You can configure many components of the user interface: colors, preffered language, help bars, and key mappings.
You can redefine up to the eleven colors used in JERED. Seven of them are general colors, four of them are specific to the C/C++ languages and are unused otherwise. JERED knows if you are editing a C or C++ source file according to the file's extension. Each color value is made of a foreground color, a background color and up to two screen attributes. These components are mixed together to make a JERED's color. The syntax for the color variables is slightly different than the syntax for other variables because of the four components of a color. it is the following:
COLOR_XXXX:FOREGROUND:BACKGROUND:ATTRIBUTE1:ATTRIBUTE2
FOREGROUND and BACKGROUND are mandatory, while ATTRIBUTE1 and ATTRIBUTE2 are
optional. FOREGROUND, BACKGROUND, ATTRIBUTE1 and ATTRIBUTE2 are color and
attributes names as they are defined in the Ncurses
library.
Here is the list of the available colors and their default value:
COLOR_STATUS is the color of the status bar at the top of the screen. The default value is black on cyan without any special attribute.
COLOR_HELP is the color of the normal and escape help bars at the bottom of the screen. The default value is black on cyan without any special attribute.
COLOR_HIGHLIGHT is a color you can use when redefining your help bars. When
typing the text of your help bars, precede each character you want to highlight
with an ampersand &
. The default value is bold red on cyan.
COLOR_ALERT1 is the color for the body of alert and dialog boxes. The default value is black on cyan without any special attribute.
COLOR_ALERT2 is the color of selected buttons in alert boxes and online help in dialog boxes. The default value is blinking cyan on black.
COLOR_BLOCK is the color of marked blocks of lines. The default value is white on blue without any special attribute.
COLOR_NORMAL is the color in which the file you are editing is displayed, unless if it is a C or C++ source file. The default value is white on black without any special attribute.
COLOR_CHAR is the color of character constants in C or C++ source files. The default value is bold magenta on black.
COLOR_KEYWORD is the color of C or C++ keywords if you are editing a C or C++ source file. The default value is bold red on black.
COLOR_STRING is the color of string constants in C or C++ source files. The default value is bold blue on black.
COLOR_COMMENT is the color of C or C++ comments in C or C++ source files. The default value is green on black without any special attribute. Multi-lines comments are not well colorized.
JERED was written with being Easy to Use as a goal, so it accepts several
languages for the user interface. Actually you can choose between five languages
for all the messages and the help of the user interface. Available languages are
English, French, Finnish, German and Russian. For now German is the same as
English but a translation will come. In order to be able to use the Russian
language you have to load the KOI-8
font using the
setfont
utility. You choose your language with the following
syntax:
LANGUAGE:value
where value is either ENGLISH
or FRENCH
or
FINNISH
or GERMAN
or
RUSSIAN
.
If you don't want to use the default key mappings, you'll certainely want to
modify the default help bar without recompiling the whole editor. This is why
the HELPBAR
variable exists. You can change it this way:
HELPBAR:This is the new &Help &Bar
This will override the compile time helpbar, but you will have to modify it
if you choose another language after that.
When you press the ESC
key, another help bar is displayed.
For the same reasons as above, you'll certainely want to change it, this is
possible this way:
ESCHELPBAR:This is the new ESC &Help &Bar
Same remarks as above.
Other variables don't modify the user interface's appearance but modify the internal work of JERED. Here is a list of all these variables and an explanation of each of them.
This variable allows you to choose the tabulation size when you edit files. When you load a file, each tab character is expanded to TABSIZE space characters. When you're editing a file, there's no tab character at all in memory: there are only normal characters and spaces. You can change this value this way:
TABSIZE:n
where n
is a decimal number. The default value is 8.
If you modify this variable during an editing session, the editor will use the
new value but will not reformat the files which are already in memory.
This variable allows you to choose if spaces will be converted to tabs + spaces characters every time you save a file or not. You can change this value this way:
SAVETABS:value
where value is either YES
or NO
. The default
value is NO
, which means that files are saved without any tab
character in them. You must take care of setting it to YES
if
you are editing a makefile, otherwise make
will not work
properly.
These variables allow you to choose the beginning and ending column at which
blocks will be reformatted when you call the
Reformat a Block of Lines
function.
You can change them this way:
WORDWRAPBEGIN:bc
WORDWRAPEND:ec
Where bc is a decimal number defining the beginning column and ec is a decimal
number defining the ending column. The default value for WORDWRAPBEGIN is 1 and
the default value for WORDWRAPEND is SZBUF - 10
where
SZBUF
is the constant defined in jered.h
which indicates the maximum length of a line (2048 characters for now).
This variable allows you to choose if the text will be automatically reformatted according to WORDWRAPBEGIN and WORDWRAPEND while you are typing it. You can change it this way:
AUTOWORDWRAP:value
where value is either YES
or NO
. The default
value is NO
.
For now this variable is not used at all, so text will never be automatically
reformatted.
This variable allows you to choose the locking method for the files you are editing. You can change it this way:
LOCK:value
where value is either NONE
, READONLY
or
STRICT
. NONE indicates that other users
may read or write files while you are editing them. READONLY indicates that
other user can just read files while you are editing them. STRICT indicates
that nobody can read or write files while you are editing them. The default
value is NONE
, which means that other people can access files
while you are editing them without any restriction.
This variable allows you to control if a backup copy should be done each time you save a file. You can modify it this way:
BACKUP:value
where value is either YES
or NO
. The default
value is YES
, meaning that every time you save a file a backup
copy is made with the same name plus the extension .bak
This variable will control the frequency at which automatic save of modified files is done. You can change it this way:
AUTOSAVE:value
where value is a decimal number defining the number of seconds between two
automatic save of modified files. The default value is 0, which means NO
automatic save. Each automatically saved file is saved with its original name
plus a tilde at its end. For example, if BACKUP
is set
to YES
and you are editing the file foo.c, after a manual
save and an automatic save you'll have four files:
foo.c
foo.c.bak
foo.c~
foo.c.bak~
This variable allows you to control wheter macros mapped to keys will be automatically played when you type the key or not. You can change it this way:
AUTOPLAYMACRO:value
where value is either YES
or NO
. The
default value is YES
. If you change it to NO
then you'll have to type on the key which plays macros (by default
Ctrl_P
) after having typed on the key on which the macro
is mapped.
This variable will allow you to force your terminal to be detected as a color terminal even if it is monochromatic. This will allow you to choose other attributes than those defined at compile-time for mono terminals. You can change it this way:
COLORS:value
where value is either YES
or NO
. The
default value is NO
which means you let the system detect
the type of your terminal. If you change it to YES
then your terminal will be detected as a color one and you will be able to
modify the COLOR_xxxx
variables.
If the default key mapping doesn't correspond to what you want, or if you want to map text strings or macros to keys, you have to learn how to do this sort of things. There are three ways to change a key mapping, depending on what you want to map to the key: a text string, a macro, or a JERED internal function.
When I wrote this software I decided to use when possible the same naming
convention for special keys than the curses
library, and
to extend this convention to what I call normal keys. I've also extended this
convention to what I call ESC keys, which are key combinations which begin
with a keypress on the Escape
key. Finally I've added the
possibility to give a key name using the number returned by a keypress on this
key and to simply name key combinations based on the Ctrl
key.
Each key name must begin with KEY_
for simple keys, or
ESC_KEY_
for key combinations which begin with a keypress on
the Escape
key.
Then you could eventually add CTRL_
to the key name if the
key value is comprised between 1 and 26 decimal (from Ctrl_A to Ctrl_Z).
Then you add the last component of the key name. The last component could be
either the curses key name without the leading KEY_
, the
character written on the keyboard, or an hexadecimal value representing the
value returned by a keypress on this key.
If this section is not clear for you, just read the default profile file which comes with this package. It will give you lots of examples and all the internal functions names and their goal.
You can assign text strings to keys, it is useful when you often type the same thing. For example your email address. You can change a text string mapping this way:
keyname:TEXT_string
Now lets' see some examples:
For example you want that each time you press on the 'A'
key
JERED receives the string Hello World !!!
. This can be done
this way:
KEY_A:TEXT_Hello World !!!
For example you want that each time you press on Ctrl
and
'U'
simultaneously JERED receives the string
Windows is Bullshit
. This can be done this way:
KEY_CTRL_U:TEXT_Windows is Bullshit
For example you want that each time you press on the Escape
key followed by the '@'
key JERED receives your email
address. This can be done this way:
ESC_KEY_@:TEXT_yourname@yourhost.yourdomain
You can assign macros to keys, it is useful when you often type the same complicated thing. For example you want to load several files into JERED, then search and replace a string in each of them, then save each file and switch to the next file. You want to do this a lot of times, every day for example. This can be done very easily with a macro. First you record the macro, then you assign it to a key. You can do this this way:
keyname:MACRO_filename_of_the_macro
Now an example:
For example you want that each time you press on the Escape
key followed by Ctrl_V
then JERED plays the macro named
/home/jerome/macros/testmacro.jem, this can be done this way:
ESC_KEY_CTRL_V:MACRO_/home/jerome/macros/testmacro.jem
You can assign internal functions to keys, JERED itself works this way with a set of predefined key mappings. You can change a function mapping this way:
keyname:FUNCTION_internal_function_name
Now an example:
For example you want that each time you press on the BACKSPACE
key the current line will be deleted. This can be done this way:
KEY_BACKSPACE:FUNCTION_DELETELINE