ARPUS/ce, Version 2.6.2 (03/10/05) (SCCS 1.9) _______________________________________________________________________________ Concept: Keys and key definitions. DESCRIPTION: While everything you want to accomplish in an edit window can be done explicitly through command input at the "Command: " prompt, you will most likely use a variety of keys or key combinations that invoke ce commands. In general, every key on the keyboard can be defined to execute some Ce command sequence. The modifier keys (Shift, Ctrl, Alt, ... ) can be used to multiply the number of possible definitions. In addition, the mouse keys are considered to be keys with the names m1 (for the left button), m2 (for the center button), and m3 (for the right button). In compliance with X standards, m4 and m5 can be defined, but a 5 button mouse would be needed to access these. Both the downstroke of a key or mouse button can be defined as well as the upstroke. The "kd" command is used to assign Ce command sequences to keys and to view the command sequences for a given key name. The help page for the kd command contains the syntax for defining keys with and without the various modifiers and also putting a definition under the upstroke of a key. The kk command information on the X key names associated with keys. Example 1: An example is the "<RETURN>" key. When the cursor is in a ce or cv window, and "<RETURN>" is pressed, it implements the ce command "en", which means "insert a newline character at the cursor position". In other words, the "<RETURN>" key is DEFINED as the command sequence "en". One popular re-definition of the "<RETURN>" key is "tr;en", which first places the cursor at the end of the current line (tr) and then inserts a newline character. Effectively this key definition causes "<RETURN>" to insert a new line below the current line without changing the current line. Example 2: In the above example, the "<RETURN>" key invokes a single ce command. In general, a single key or a key combination can invoke a series of commands. For example, the key combination "<CONTROL> t" by default moves the cursor to line 1, column 1; that key combination is defined as "pt;tt;tl", which is a series of 3 ce commands separated by semicolons. Key Definitions: The ce software is delivered with a standard set of key definitions. The 'ce_init' command copies a file containing those standard definitions into $HOME/.Cekeys. If you look at that file, you will see a number of lines of the form "kd <keyname> <definition> ke". 'kd' is the ce command to assign a definition to a key. Once you are comfortable with how those key combinations operate, you will probably want to customize them or add new ones to suit your editing style. "$HOME/.Cekeys" is loaded the first time you invoke ce or cv in a login session. If you want to create a key definition that works every time you start ce or cv, add your own 'kd' command to that file. Key definitions assigned from the command input window are good only for the duration of the login session. When Ce loads key definitions, it first checks environment variable CEKEYS. If it exists, its value is used as the name of the file to load the key definitions from. If this variable is not set, "$HOME/.Cekeys" is used. This feature is useful if you have one home directory but use several hardware platforms. In this environment, you usually have your .profile determine which machine you are logging on to. At this point you can set the CEKEYS environment variable to an appropriate set of key definitions. You can also use this to load an arbitrary file by temporarily setting CEKEYS and running "ce -reload". In Borne or Korn shells this would be: CE_KEYS=some/path ce -reload Extended Key Definitions: The default key definitions described above use keys that can be found on virtually every keyboard. The definitions do not take advantage of keys with special labels such as "Cut", "Paste", etc. This is because keyboards vary greatly from system to system. The ce software includes additional key definition files to take advantage of those special keys. Type "ce_init sysnames" for a listing of systems for which ce has extended key definition files. You will probably find a key definition file that matches your system's keyboard. DETAILS: Keys which are not defined in the .Cekeys file may carry default definitions. These are generally the Alphabetic and numeric keys. It is not necessary to define the 'a' key as "es 'a'" explicitly. Ce deals with these by default. It is however possible to define the 'a' key to do something else. The command "kd a es 'eee' ke" will cause the 'a' key to be equivalent to pressing the 'e' key three times. This is generally a bad idea since you may end up resorting to copy and paste to get a letter 'a' to redefine the key. If a key definition is set to null as in "kd a ke", the key will take on it's default meaning. The calculation of default key definitions is affected by the "isolatin" parameter and X resource and the state of vt100 emulation in ceterm. vt100 emulation overrides the isolatin state. Default key definitions are always in the form of "es" commands for the character pressed. The following discussion references keys which have a value associated with them. The value referenced is the XLookupString value for the key event generated when the key is released. This value can be determined with the standard xev program by starting xev, moving the pointer into the xev window and pressing the desired key. The last line of the information displayed for the key press event is the XLookupString value. Beware that xev also reports data on the key release so make sure you are looking a the right thing. In the default, state (isolatin off, vt100 off), a key has a default key definition if the key press event has an value with a length other than zero and no modifiers other than shift are currently pressed. Thus, even though ^c has a value of x'03', an es of the 03 is not generated if you press ^c in a window when there is no key definition for ^c. In isolatin mode, the restriction on modifier keys is removed. This is because many of the special European keys use special modifiers to access them. For example: On many HP/UX keyboards, the <extend-char>h combination yields the Yen symbol when using an isolatin font. If a non-isolatin font is used, it generates a non-printable character. If a user is making use of the special symbols and European characters accessed via the <extend-char> key, it is desirable to insert the code for these special characters into the file just as if they were a standard character. However, if one is using an American font and not using these characters and there is no Ce key definition for *yen, it is desirable to do nothing. This makes the action consistent with pressing *F2 when *F2 has not been defined. In vt100 emulation mode in a ceterm, if the key has a value, the value is used even if the key has a key definition. Only if a key does not have a value, is a Ce key definition used. Note also, that in vt100 emulation mode, special values are assigned to the numeric keypad keys and function keys 1 to 8. SUGGESTION: If you are an Apollo user migrating to another platform, take your key definition file from your Apollo and put in on the new platform. The key names change, but most of the names are obvious, f1 becomes F1. The kk command can help you find the names of the other keys. Thus you can carry your customized environment with you. Some platforms have a left hand bank of keys with copy and paste keycaps. These make a good choice for many of the keys from the left hand key bank on the Apollo. In most cases, the key definition syntax is the same from the Apollo. In a few cases, the number of escape characters changes. Sorry. Carrying your custom key definitions with you can go a long way toward making you comfortable on the new platform. CONVERTING KEYDEFS FROM AEGIS TO UNIX REGULAR EXPRESSION MODE: Some key definitions employ search commands (both forward and reverse) which make use of "regular expressions" to do the pattern matching. Ce supports both the "regular expressions" use by Apollo Domain machines and the standard Unix "regular expressions". By default, Ce is installed in Aegis regular expression mode. Ce can be converted to Unix regular expressions by either the system administrator or the individual user. The changes made by the system administrator affect anyone who runs the ce_init command. Changes made by an individual affect only that user. SYSTEM ADMINISTRATOR CHANGES: In $CEDATADIR/.Xdefaults find the line containing Ce.expr : Unix In the .Xdefaults file, find the line which contains "Ce.expr : U" and uncomment this line. If the line above it, which contains "Ce.expr : A" is not commented out, comment it out by placing an '!' in column 1. In each of the keydef files with a ".common" suffix, find the string "Ce.expr". This string will be in a comment. Following this line will be one or more key definitions followed by a group of commented out key definitions with the same key names prefixed by "#Unix expr". Comment out the first set of key definitions and uncomment the second by removing the '#Unix expr' marker string. It is suggested that when commenting out the Aegis regular expression lines that the string "#Aegis expr" be used in case someone wishes to reverse the process. INDIVIDUAL USER CHANGES: First the X resource used by Ce must be changed to Unix mode. On machines not running HP/UX or COSE, edit the .Xdefaults file and find the Ce.expr line which was created by ce_init. Uncomment the "Ce.expr : Unix" line by removing the '!'. .Xdefaults files use '!' as the comment character. On HP/UX or COSE machines, create a file such as /tmp/file with the line Ce.expr : U and then execute xrdb -merge /tmp/file Then use the palate to resave your home session. In your $HOME/.Cekeys file, find the string "Ce.expr". This string will be in a comment. Following this line will be one or more key definitions followed by a group of commented out key definitions with the same key names prefixed by "#Unix expr". Comment out the first set of key definitions and uncomment the second by removing the '#Unix expr' marker string. It is suggested that when commenting out the Aegis regular expression lines that the string "#Aegis expr" be used in case someone wishes to reverse the process. If your installation has been defaulted to Unix "regular expression" mode by the system administrator and you wish to change back to Aegis mode, you are at the mercy of the system administrator. If the Aegis mode definitions were commented out with "#Aegis expr" as is recommended above, you just reverse the conversion process. If the original lines were deleted, You will have to convert ^F5 and the mouse definitions yourself. The mouse definition keys are listed near the end of this help file. MULTIPLE SETS OF KEY DEFINITIONS: The environment variable CE_KDP can be used to have multiple sets of key definitions active on the same display at the same tine. If the -kdp argument is NOT specfied and the CE_KDP environment variable is set all windows started with this use a separate set of key definitions. The value of the environment variable is not critical. By default, key definitions are associated with an X property name CeKeys. When the CE_KDP environment variable is set, the key definitions associated with the X property whose name is the value of the CE_KDP environment variable is used. If there are not key definitions associated with this X property name, the .Cekeys file on the machine where the ce or ceterm is running will be loaded and associated with this name. There are cases where a person wants to use different key definitions for windows originating on a particular machine. By setting the CE_KDP environment variable in the .profile for that machine to other than the default value, ce and ceterm windows started on that machine will use key definitions from a $HOME/.Cekeys file on that machine. If you do this, you are on your own as far as keeping track of which windows are using which set of key definitions. WARNINGS: 1. It is possible to define keys which cannot be pressed. This can be done in two ways. First all the X key names known to your X server are available for definition. Thus you could type "kd yen es 'abc' ke" even if there is no key on your keyboard which generates the yen keysym. The other is by miscombining modifiers to create unreachable states. For example, the definition "kd aS es 'ab' ke" would appear to redefine the shifted 'a'. However, more specifically, it defines the shifted lower case 'a'. When the shift key is pressed, the keysym generated by the X server is the upper case 'A'. Thus you will not ever get a shifted lower case 'a', only a shifted upper case 'A'. By the same rule, if you want to redefine upper case 'A', you need to define upper case 'A' shifted (AS). Ce cannot code special cases for this since it is quite legal to use the xmodmap utility to define some key which generates the lower case 'a' keysym when the shift key is pressed. 2. Occasionally one may suddenly find that none of the key definitions appear to work. You check the definition and it is there, but you press the key and nothing happens. Check to see if the cap's lock is down or the num-lock. Thus all the keys are being subjected to the modifier. The num-lock is not a problem on some platforms but is on others. To fix the problem permanently and free up the NumLock key for other purposes, put the following line in your .dtprofile, .vueprofile, or .openwin-init file as appropriate. xmodmap -e "remove mod3 = Num_Lock" 2>/dev/console If you do this, a popular set of custom key definitions you can apply to your .Cekeys file are as follows: kd Num_Lock rec -p cemacro ke # macro record on kd KP_Divide rec ke # macro record off kd KP_Multiply cmdf -p cemacro ke # macro play If you are doing something repetitive, like shifting a column over 3 spaces, you would press Num_Lock to turn recording on, type the 3 spaces, press arrow down to get to the next line, press arrow left 3 times to get back under the next spot to move, and press the Key Pad Divide key to turn recording off. Then press key pad multiply and it will repeat the insert 3 spaces, go down a line, move left 3 spaces with one keystroke. SPECIAL SUN NOTES: Some Sun keyboards have a blank key on the top row next to the Help key and 4 blank keys on the top row at the right side of the keyboard. Using the kk command on these keys will give a keysym of "#0" and also list the hardware key code. Since there is no keysym for this key, it cannot be defined. To create a keysym for this key, put the following line in your .dtprofile file (for CDE) or .openwin-init file (for Open Windows) before the first toolwait command. You can create a .openwin-init file by coping $OPENWINHOME/lib/openwin-init to .openwin-init in your home directory. xmodmap -e "keycode 0x34 = Greek_ALPHA" \ -e "keycode 0x09 = Greek_BETA" \ -e "keycode 0x0b = Greek_GAMMA" \ -e "keycode 0x37 = Greek_DELTA" \ -e "keycode 0x16 = Greek_EPSILON" The Sun Type 5 keyboards often map the numeric key pad to odd function key numbers and also to the key keysym as the arrow keys and page up keys. To break these out for independent use you can put the following in your .dtprofile or .openwin-init as appropriate. They set the keysyms for the numeric pad to the more intuitive values. xmodmap -e "keycode 0x65 = KP_0" \ -e "keycode 0x77 = KP_1" \ -e "keycode 0x78 = KP_2" \ -e "keycode 0x79 = KP_3" \ -e "keycode 0x62 = KP_4" \ -e "keycode 0x63 = KP_5" \ -e "keycode 0x64 = KP_6" \ -e "keycode 0x4B = KP_7" \ -e "keycode 0x4C = KP_8" \ -e "keycode 0x4D = KP_9" xmodmap -e "keycode 0x39 = KP_Decimal" \ -e "keycode 0x84 = KP_Add" \ -e "keycode 0x4e = KP_Subtract" \ -e "keycode 0x36 = KP_Multiply" \ -e "keycode 0x35 = KP_Divide" RELATED HELP FILES: kd (Key Definition) lkd (Local Key Definition) kk (Key Key) commands (List of Commands) xresources (Arguments and X resources) keyboard (default definitions) support (customer support) xev manual page (execute man xev from a Unix prompt) xmodmap manual page (execute man xmodmap from a Unix prompt) USEFUL KEY DEFINITIONS: The standard Ce key definitions handle most of the editing functionality using a standardized set of keys. However, to provide examples of other uses of the Ce command set, the following key definitions are provided along with explanations. These key definitions have been found to be useful and may be of interest. With the exception of the mouse keys, the key name used for a given key may change based on the actual key map used at your site. To try out any of these key definitions, copy them to the bottom of your .Cekeys file and run "ce -reload" to install them. # # The following definitions set the Shell DISPLAY environment variable to the # place the ceterm is being displayed. This is useful when doing telnets. The # first definition is for non-vt100 mode. The second is for vt100 mode. # kd *h env CEHOST;tdmo;tl;/=/;ar;dr;tr;xc -l host;ti;tl;xd -l junk;es 'DISPLAY=';xp host;tr;es ';export DISPLAY';en;msg ' ' ke kd *F1 env CEHOST;tdmo;tl;/=/;ar;dr;tr;xc -l host;tmw;es 'DISPLAY=';xp host;es ';export DISPLAY';er 0d ke # on HP's replace *h with kd *yen env CEHOST;tdmo;tl;/=/;ar;dr;tr;xc -l host;ti;tl;xd -l junk;es 'DISPLAY=';xp host;tr;es ';export DISPLAY';en;msg ' ' ke # # Many users use the numeric pad keys to arrange windows with the keypad # mapping to the screen. That is, the '9' key in the upper right of the # keypad puts the window in the upper right corner of the screen. The '8' # is the top half of the screen, the '4' is the left side of the srceen and # so on. They key names may differ with different keyboards and the # exact geometries may vary with different display screen sizes. This should # provide a good start. # # # Apollo DN # kd np1 geo 600x517+0+480 ke kd np2 geo 1200x517+0+480 ke kd np3 geo 600x517-80+480 ke kd np4 geo 600x994+0+0 ke kd np5 geo 1200x994+0+0 ke kd np6 geo 600x994-80+0 ke kd np7 geo 600x517+0+0 ke kd np8 geo 1200x517+0+0 ke kd np9 geo 600x517-80+0 ke # # HP/UX 700 series # kd KP_7 geo 575x420+90+35 ke kd KP_8 geo 1180x420+90+35 ke kd KP_9 geo 575x420-10+35 ke kd KP_1 geo 575x400+90-120 ke kd KP_2 geo 1180x400+90-120 ke kd KP_3 geo 575x400-10-120 ke kd KP_4 geo 575x860+90+35 ke kd KP_5 geo 1180x860+90+35 ke kd KP_6 geo 575x860-10+35 ke kd KP_5S geo c80x24+100+100 ke # # Sun Sparc 10, 16" monitor # kd `F27 geo 560x365+5+25 ke kd `Up geo 1140x365+5+25 ke kd ~Up geo 905x365+245+25 ke kd `F29 geo 560x365-5+25 ke kd `R13 geo 560x410+5+425 ke kd `Down geo 1140x410+5+425 ke kd `F35 geo 560x410-5+425 ke kd `Left geo 560x810+5+25 ke kd `F31 geo 1140x860+5+25 ke kd `Right geo 560x810-5+25 ke kd F31S geo c80x24+200+200 ke # # IBM RS6000 # kd KP_7 geo 550x465+10+35 ke kd KP_8 geo 1175x465+10+35 ke kd KP_9 geo 550x465-100+35 ke kd KP_1 geo 550x465+10-35 ke kd KP_2 geo 1175x465+10-35 ke kd KP_3 geo 550x465-100-35 ke kd KP_4 geo 550x990+10+35 ke kd KP_5 geo 1175x990+10+35 ke kd KP_6 geo 550x990-100+35 ke # # X Station with 14" screen # kd KP_7 geo 490x335+10+35 ke kd KP_8 geo 1000x335+10+35 ke kd KP_9 geo 490x335-10+35 ke kd KP_1 geo 490x335+10-10 ke kd KP_2 geo 1000x335+10-10 ke kd KP_3 geo 490x335-10-10 ke kd KP_4 geo 490x720+10+35 ke kd KP_5 geo 990x700+10+35 ke kd KP_6 geo 490x720-10+35 ke kd *KP_9 geo 790x353+224+34 ke # # Dec Alpha # kd KP_7 geo 550x465+10+35;tt ke kd KP_8 geo 1175x465+10+35;tt ke kd KP_9 geo 550x465-100+35;tt ke kd KP_1 geo 550x465+10-35;tt ke kd KP_2 geo 1175x465+10-35;tt ke kd KP_3 geo 550x465-100-35;tt ke kd KP_4 geo 550x990+10+35;tt ke kd KP_5 geo 1175x990+10+35;tt ke kd KP_6 geo 550x990-100+35;tt ke # When choosing a font to call your favorite. The following # key definitions are useful. # execute "xlsfonts | cv" from the Unix command window and # have the following key definition installed. # position the cursor over a font you want to try and press # alt-z. This font will be loaded. When you find a font # you like, put it in the .Xdefaults file for Ce:font. # If you get an unreadable font loaded, pick some random # line and load that font. That should at least make it readable. # kd *z tl;dr;tr;xc -l font;tdm;tl;xd -l junk;es 'fl ';xp font;tr;en ke #on HP's use kd *paragraph tl;dr;tr;xc -l font;tdm;tl;xd -l junk;es 'fl ';xp font;tr;en ke # When choosing colors, execute "cv /usr/lib/X11/rgb.txt" # This gives a list of all the colors known to your X server. # With the following key definitions, mod1-X will load the # color on the current cursor line as the background. # ctrl-mod1-X will load the color as the foreground color. # On Sun, mod1 is usually the diamond key. On other boxes # it is the alt key. kd *x [,14]dr;tr;xc -l color;tdm;tl;xd -l junk;es 'bgc ';xp color;tr;en ke kd ^*x [,14]dr;tr;xc -l color;tdm;tl;xd -l junk;es 'fgc ';xp color;tr;en ke on HP's use kd *scaron [,14]dr;tr;xc -l color;tdm;tl;xd -l junk;es 'bgc ';xp color;tr;en ke kd ^*scaron [,14]dr;tr;xc -l color;tdm;tl;xd -l junk;es 'fgc ';xp color;tr;en ke # # When programming, it is nice to be able to quickly find # balancing delimiters. The following key definition is # useful to match delimiters. See the help for bl for more # information on bl. kd *b bl -d ke _______________________________________________________________________________ Copyright (c) 2005, Robert Styma Consulting. All rights reserved.