Next we will change the program back to a `Hello World' program
using the search option and overwrite mode.
In this case, we tell the editor to search for a word and
overwrite this word with another.
Since the search option is issued from the command line, let
us recall the general method of entering such commands. To enter command line
commands:
- First press the <Esc> key to move the cursor to the command line.
- Then type the command in
- Finally press <return> to execute the command
Let us try out these steps:
Now the cursor has moved to the command line.
To issue a search command, follow this general formula:
type a slash / followed by the string to be searched for
and then possibly another slash with further options if
desired.
(Possible options include searching in a specified range, in
specified columns, and overriding the default search direction.
For full information, see the section on `Search and Replace').
- Type the string `
/stedi/0
' in the command line
- Press <Return>
The editor performs a search for the word `stedi' and positions the cursor
over the first letter of (the first occurrence of) that string. The `0' option
indicates that the search should be done in circular mode.
In this mode, the editor begins the search at the
location of the cursor wherever it is in the file and moves
forward towards the end of the file. If the string is not found when the
cursor reaches the end of the file, then the search carries over to
the beginning of the file and continues forward. If the string is
still not found, the search stops when the cursor gets back to its
original position. In our case the string `stedi' should definitely be found!
Note also that you have a choice between making your search case-sensitive or
not. The default mode is indicated by the fourth status character in the
status bar (an `S' or an `N'),
and there is an option for the search command to override this if
desired. Thus if the fourth status character is an `N', you may equally well
enter the command `/stedi/0
' and the same result would have been achieved.
To overwrite the word `stedi' with `World', first put
the editor in overstrike mode:
- Press Alt-O
- Then type the string `World'.