This chapter will take you through a simple Ce edit session to introduce you to basic Ce operations. We strongly encourage you to follow the examples by using Ce while you read this chapter.
This chapter describes the following:
These sections are intended to be introductory in nature. Subsequent chapters present information on commands and concepts in greater detail.
Type the following command in your shell.
Command: % ce -version
If Ce is already in your search path, it will execute output that looks something like this:
ARPUS/ce, Version 2.5 Compiled: Nov 26, 1997 11:07:04
If Ce is not in your path you will receive a message like this:
ce: Command not found.
In this case, you will need to ask your system administrator where the Ce commands are located, and add to your shell's "$PATH" environment variable the directory that contains those commands.
If you execute Ce and an empty window comes up for a while and then goes away with a message about not being able to get a license, either the license server is not running or you do not have your LSHOST environment variable set to the node running the license server. See Chapters 9 and 10 for more information.
Ce allows you to assign edit commands and command combinations to specific keys. For your convenience, Ce includes a set of key definitions already developed for your keyboard. It is possible that your system administrator or someone else has set up a ".Cekeys" file in your home directory already. Check to see if that file exists. If so, you can probably skip this step. Find out who created the file for you and what changes they made from the default definitions. Before using Ce, you should run the "ce_init" program to copy the default key definitions into your home directory using the following command:
UNIX: ce_init
"ce_init" will create a file in your home directory called ".Cekeys". Chapter 8, Key Customization, describes the use of that file. For the remainder of this chapter, you do not need to concern yourself with the contents of that file, only that it is properly installed in your home directory. If you have run ce before you ran "ce_init", you will need to run "ce -reload" one time.
If you use more than one type of machine (for example Sun and HP) and you use the same home directory for both machines, you will need to have a separate ".Cekeys" file for each platform. This only applies if you physically sit in front of each type of machine. If you always sit at the same workstation and just telnet or rlogin to other machines you only need key definitions for your machine. The reason for multiple sets of key definitions on multiple machine types is that the keyboards are different. The environment variable CEKEYS allow you to change the name of the ".Cekeys" file. Run "ce_init" on one platform and then rename the created ".Cekeys" file to some useful name such as ".Cekeys.hp". In your .profile, ".vueprofile" on HP/UX, determine what type of machine is running and set the CEKEYS environment variable to the appropriate name. For example:
"export CEKEYS=~/.Cekeys.hp"
If you are upgrading to a new release of Ce and would like the new key definitions, but do not want to loose your existing customizations, execute the following UNIX command:
UNIX: ce_update
This command will make add any new default key definitions to the end of your current ".Cekeys" file. Only keys which are currently undefined are added.
NOTE: The key definitions are held in your HOME directory in the file ".Cekeys". The definitions set up by "ce_init" are a basic editing suite. If you don't like the way a particular key behaves, you can probably change it to your liking. For example, The left arrow key, which moves the cursor one character left executes the Ce primitive command "al" and stops when it hits column 1 of the current line. Some people prefer to have the cursor jump up to the last character of the previous line. Changing the key definition to execute "[,-1]" (move one character left in the file) will do this. If you can't see how to do something, write for help via email to the support address.
Enter the following command from a shell prompt:
UNIX: ce ~/ce_practice
The file "$HOME/ce_practice" was created by "ce_init" If you receive the message "Unable to find key definition file", you will still get a Ce session; however, your keys will not be properly initialized. This should not happen if you executed the "ce_init" command prior to running ce. Ce accepts a number of command line options. Those options are discussed in chapter 3, Environment Customization. See Initialization of Your Personal Ce Environment Section.
Figure1-1 shows the basic components of a Ce session. (Since Ce runs in a number of X Window System environments, such as OSF/Motif and Open Windows, the Figure does not describe details that relate to the window manager.) The functions of the various components are as follows (the numbers of these descriptions correspond to the circled numbers in the illustration):
Note that when you place the mouse cursor in either (9), (10), or (11), the mouse cursor and text cursor stay together, unless the "-mouse no" command line option or the "Ce.mouse: no" X resource are used.
Figure 1-1. Appearance of Ce Session
Cursor control involves moving the text cursor within the window. Table1-1 lists the cursor movements that are possible, along with the keys that cause those movements. The key names shown in Table 1-1 are keys that are common to all workstation keyboards. Moving the mouse also moves the cursor.
Table 1-1. Cursor Control
Movement |
Default key(s) |
Cursor up |
Arrow Up |
Cursor down |
Arrow Down |
Cursor left |
Arrow Left |
Cursor right |
Arrow Right |
Tab right one stop |
Tab |
Tab left one stop |
<Shift> Tab |
To start of line |
Home |
To end of line |
End |
To "Command: " prompt |
Escape |
Window scrolling is accomplished via keypresses or the scroll bar. By default, the vertical and horizontal scroll bars appear as necessary. The window can be scrolled either vertically (up and down by lines or pages) or horizontally (left and right by columns). Table 2.2 lists the scroll operations and their default key assignments.
Table 1-2. Window Scrolling
Movement |
Default key(s) |
To top of file |
<Ctrl> t |
To bottom of file |
<Ctrl> b |
Page up 1/2 page |
Page Up |
Page down 1/2 page |
Page Down |
Page up 1 line |
<Shift> Arrow Up |
Page down 1 line |
<Shift> Arrow Down |
Scroll Right 10 Columns |
<Shift> Arrow Right |
Scroll Left 10 Columns |
<Shift> Arrow Left |
Do not be concerned if the above key function assignments are not to your liking. Chapter 8, Key Customization provides detailed information on modifying these definitions as well as creating your own.
In its default operating mode, Ce links the mouse and text cursors. Thus entering alpha-numeric and other printable characters requires only placing the cursor at the proper point of insertion and typing the desired characters.
Table1-3 lists the most basic editing operations. Some keyboards, such as the SUN type-5 keyboard or the HP Workstation keyboard, have special extended function keys. These are mapped as appropriate.
Table 1-3. Basic Editing
Operation |
Default key |
Extended key |
Delete character under cursor |
Delete |
|
Delete character to left of cursor |
Backspace |
|
Delete entire line under cursor |
F5 |
Del |
Delete from cursor to end of line |
<Shift> F5 |
|
Delete word under cursor |
<Ctrl> F5 |
|
Insert most recently cut line |
F6 |
Insert |
Insert most recently cut to-end-of-line |
<Shift> F6 |
|
Insert most recently cut word |
<Ctrl> F6 |
|
Undo most recent change |
F7 |
Undo |
Redo most recent undo |
<Shift> F7 |
Redo |
Split the current line |
Return |
Enter |
Insert a new line below cursor |
<Shift> Return |
|
Toggle between insert and overstrike |
Insert |
|
As mentioned earlier, Ce operates in two distinct modes with respect to text editing: insert mode and overstrike mode.
The differences between insert and overstrike modes are obvious when entering straight text but are somewhat more subtle with respect to Backspace and Return operations.
Note that any change, including those mentioned in Table 1-3, can be undone via the "undo" command, which is assigned to the F7 key. Furthermore, if you undo a change and then decide that you really did want that change, you can undo an undo via the "redo" command, which is assigned to the "<Shift> F7" key combination. Ce allows you to undo all the way back to the beginning of the edit session. If you undo a change and make a different change, you cannot redo the original change you undid.
Ce provides easy ways to duplicate portions of text and move portions of text from one location in the file to another. Such operations are facilitated through the use of paste buffers. Copying text, moving text, and deleting (cutting) text all involve the same basic steps, and by default these steps are accomplished using the function keys F1, F2, F3, and F4. Table 1-4 shows the steps required to perform any of those three operations.
Table 1-4. Normal (non-Rectangular)Copy/Moving/Cutting Operations
|
Copying text |
Moving text |
Cutting text |
Step 1 |
Mark start of text |
Mark start of text |
Mark start of text |
Step 2 |
Move cursor to end |
Move cursor to end |
Move cursor to end |
Step 3 |
Copy text via F2 |
Cut text via F3 |
Cut text via F3 |
Step 4 |
Reposition cursor |
Reposition cursor at |
|
Step 5 |
Paste text via F4 |
Paste text via F4 |
|
In all cases, Step 3 places the copied or deleted text into a paste buffer, which is a separate entity that is associated with but not an actual part of the file you are editing. This means that Ce remembers pieces of text that you copy or delete so that if and when you subsequently issue a paste command, Ce knows what to paste back into the file.
When defining a text region to copy or cut, the default behavior of the operation is that all text between the marked and final cursor positions is included in the region, as shown in Figure 1-2.
Figure 1-2. Normal (non-Rectangular) Copy/Cut Region
The lines that end up in the paste buffer after a copy or cut of the region highlighted in Figure 1-2 would look like this:
Note that the highlighted region includes all text between the marked and current cursor positions,
You also have the ability to handle rectangular blocks of text. The mark, copy, cut, and paste operations all have rectangular analogs, initiated via the use of shifted function keys, as Table 2.5 shows:
Table 1-5. Rectangular Copy/Moving/Cutting Operations
|
Normal |
Actual Ce |
Rectangular |
Actual Ce |
Mark |
F1 |
dr; echo |
<Shift> F1 |
dr ; echo -r |
Copy |
F2 |
xc |
<Shift> F2 |
xc -r |
Cut |
F3 |
xd |
<Shift> F3 |
xd -r |
Paste |
F4 |
xp |
<Shift> F4 |
xp -r |
Figure 1-3 and the paragraph immediately following it illustrate the appearance of a highlighted rectangular text region and the lines in a paste buffer copied or cut from such a region.
Figure 1-3. Rectangular Copy/Cut Region
The lines that end up in the paste buffer after a copy or cut of the rectangular region highlighted in Figure 1-3 would look like this:
highlig between positio long te
NOTE: Be aware of this important characteristic about the differences between normal and rectangular operations: Once the text is in the paste buffer, no record is kept about whether the operation that put the text there was normal or rectangular. If you want to do a rectangular copy followed by a rectangular paste, you must use the rectangular versions of both commands.
By default, the copy, cut, and paste commands all use the same internal paste buffer. As a result, a copy or cut operation wipes out any data in the paste buffer that may have been placed there from a previous copy or cut operation.
Similarly, once you perform a copy or cut operation, that data can then be pasted repeatedly back into the file until another copy or cut operation is performed.
For most applications, the above behavior is acceptable. However, there may be instances when you would like to perform two or more copies or cuts and preserve the data from each of those operations in a distinctive fashion. Ce allows you to create named paste buffers. The default key definitions that you are using for F1, F2, F3, and F4 have equivalent functions <Ctrl> F1, <Ctrl> F2, <Ctrl> F3, and <Ctrl> F4 which use an alternative paste buffer. Setting up additional paste buffers is beyond the scope of this chapter. The subject is handled in detail in the Chapter 3, Advanced Editor Use.
It is often desirable to copy and paste between a Ce window and another application. The desired behavior would be to do a normal copy in the Ce window, move to the other application, and perform the paste using the method supplied by that application. A paste pulldown or pressing the middle mouse button are two common methods. The trick is to make sure you are using the same paste buffer name in both applications. There are two names commonly used by X based applications. They are named "PRIMARY" and "CLIPBOARD". Which name is used by any application is subject to change, but a good rule of thumb is if you are pasting with the middle mouse button, it is probably pasting "PRIMARY" and if you are using a pulldown, it is probably "CLIPBOARD". If a particular instance does not work, try the other one.
Since Ce allows you to vary the paste buffer names, it is generally easier to adjust Ce to talk to your other applications than the other way around. There are two ways of doing this. One is to use the "Ce.dfltPasteBuf X" resource. By default this is set to the name "CLIPBOARD". However, this may be set at installation time. Use the UNIX command "ce-oplist" to see if a new value was specified at installation time. To change this to "PRIMARY", put the line, "Ce.dfltPasteBuf : PRIMARY", In your ".Xdefaults" file. Changing this resource changes the paste buffer name used on copy "xc", cut "xd", and paste "xp" Ce commands which do not explicitly name a paste buffer. For systems other than SunOS 4.1.*, it is probably wise to change the default paste buffer to "PRIMARY".
You can instruct Ce to search for an exact sequence of characters or a sequence of characters that match a given pattern. Furthermore, you can define a region and instruct Ce to replace all occurrences of a character sequence or pattern within that region with another character sequence.
To search forward in the file for a specific string, do the following:
If the search succeeds, Ce will place the cursor at the beginning of the occurrence of "string", and it will scroll the window if necessary to make visible the line on which the occurrence was located.
If the search fails, Ce will indicate so by displaying the message "No match: string" in the command output window, and the cursor will be left in its original position.
If you want to search for "string" repeatedly, you need perform the above command sequence only the first time. You can repeat a forward search by pressing "<Ctrl> r", which translates to the Ce command "//".
Search operations may take into account whether the string being searched for and the text being searched are upper or lower case. Searches can happen in one of two modes:
You can also search backward in a file for a string. The proper form of the backward search command is "\string\". That is, enclose the string to be searched for between backslashes. Likewise, to repeat a backward search, press CTL/u, which translates to the Ce command "\\". The command "?string?" is equivalent to "/string/". Also, the trailing slash may be omitted.
You can replace occurrences of a character sequence or pattern with another within a defined region of text. The steps required for a search-and-replace operation are as follows:
All occurrences of "search_string" will be replaced by "replacement_string" within the defined region. If no occurrences of "search_string" are found, the message "No match" will be displayed in the command output window and the text highlight will be aborted.
A second search-and-replace command is "so", which instructs Ce to replace only the first occurrence of "search_string" on each line in the defined region.
The formats for "search_string" and "replacement_string" can include wildcard characters and other pattern matching mechanisms. See Chapter 3, Advanced Editor Use for details on such forms of search-and-replace operations. The slash character may be replaced with an alternate delimiter of your choice if the search or replace strings contain slashes. You could alternatively escape using slashes in the search or replace strings.
Normally you control window size and placement with the window manager. If you want to resize or relocate the Ce window during your edit session from within Ce, you can use the "geo" command. The syntax for the command is "geo [c]WxH+x+y", where:
It is also possible to specify a default window geometry in your "$HOME/.Xdefaults" file or when Ce is invoked from the command line. It is also possible to have Ce rotate through a series of initial window placements, sizes, and color schemes. These additional methods are described in Chapter 2, Environment Customization.
Ce includes an extensive collection of on-line help files that are available through the click of a mouse button:
If you are having trouble finding help on a topic, press "F9", and look at the topic "commands", which lists all the Ce commands. The HTML documentation has a complete index which may also be useful.
We are interested in continuously providing you with high-quality software and support, and are interested in information you have about problems with the software and also in your ideas on how the software can be enhanced.
When you want to send information about Ce to ETG, use the shell command "ce_report". (This is a shell command and not a Ce edit command.) "ce_report" copies into your home directory a pre-formatted file into which you can type information relevant to your problem or enhancement request. The file also contains specific information on how to send the completed file to ETG via surface mail, electronic mail, or fax.
We also encourage you to take advantage of our telephone support at
(770) 64-ARPUS (770) 642-7787