First practice moving the cursor around in the file with the arrow keys.
- Use the up and down arrow keys to move the cursor up and down
in the file.
Keeping an eye on the command line, you will notice that the line
number at the left end of the bar changes according to which line the
cursor is in. Notice also that when the cursor is moved beyond the end
of the program into `virtual' territory, the line number fails to
increase. Thus you will never see a line number recorded on the command
line that is not an actual line of text in the program.
Now try moving the cursor to the right with the right arrow key.
- Hold down the right arrow key until the cursor goes `past'
the edge of the screen. Keep holding it down until the cursor comes to
rest (you will need some patience).
As the cursor moves to the right edge of the screen, the screen image
shifts 20 columns to the left to show columns 21 through 100, and then
again to show columns 41 to 120 and so on until the cursor comes to rest
in column 255. Since nothing has been typed in these columns, the
screen appears blank yet the cursor is free to move into such virtual
territory.
This exercise illustrates an important point:
To move the cursor from column 255 back to the beginning of the line:
- Press the Shift-left-arrow key (combination <Shift> and
left arrow keys)
The Shift-left-arrow and Shift-right-arrow combinations are
for moving the cursor to the beginning and the end of a line
respectively. At the end of a line, the cursor comes to rest after the
last character in the line.
- Move the cursor to line 5 with the up or down arrow key
- Press the Shift-right-arrow key
This latter command should result in the cursor resting just after the
semicolon of line 5 in your program. This command is useful if you want
to append something to the end of a line. You can simply press Shift-right-arrow, and then start typing.
In contrast, to these combination shift-arrow commands which move the
cursor to the beginning and end of lines, the Ctrl-left-arrow and
Ctrl-right-arrow keys move the screen image 20 spaces in
the opposite direction to the arrow, without moving the cursor. Due to
the resultant shift of the screen, the cursor then appears 20 columns to
the left or right respectively of where it had been.
Another frequently used set of commands are the <Home> and
Shift-<Home> commands. These move the cursor to the beginning and
the end of the file respectively. Try this:
- Press Shift-<Home>
- Press <Home>
In a file only 6 lines long the action of these keys is of course not very
dramatic, but for long files these commands can be invaluable. You may want
try them out on the help file:
- Press <Help>
- Press Shift-<Home>
- Press <Home>
The help file can also be used to illustrate the Shift-up-arrow and
Shift-down-arrow commands which scroll the file up or down by 20 lines. Try
this:
- Press Shift-down-arrow
- Press Shift-up-arrow
These commands can be used for scrolling through a file a `page' at a time.
Now let's return to the `Hello World' program:
Here is a summary of the various key commands available for moving around in a
file:
- Up-arrow
- move the cursor up one line
- Down-arrow
- move the cursor down one line
- Shift-up-arrow
- move the text up by 20 lines
- Shift-down-arrow
- `page' the text down by 20 lines
(assuming a standard font size;
see the section on 'fonts' for details).
- Ctrl-down-arrow
- move the text up a line at a time
without altering the position of
the cursor.
- Ctrl-up-arrow
- move the text down a line at a time
without altering the position of the cursor.
- <Home>
- position the cursor at the first character
of the file
- Shift-<Home>
- move the cursor to the end of the file
- Ctrl-<Home>
- moves the cursor to the top left hand corner of the screen
- Shift-Ctrl-<Home>
- moves the cursor to the bottom left corner of the screen.
- Ctrl-W
- move one word forward.
- Ctrl-Q
- move one word back.
- Ctrl-X
- delete a word forward.
- Ctrl-Z
- delete a word backward.