Using the command line Commands

A particularly easy way to move the cursor is accomplished by using the command line. Since you have not learned so far how to issue command line commands, we will briefly outline here the general format of how it is done.

The general procedure for issuing a command line command is very straightforward. We summarize it below:

To return to our demonstration of moving the cursor by this method, note that we can move the cursor to any line desired simply by entering the line number as a command: Now the cursor will position itself at the beginning of line 2. Programmers will find this feature very useful in debugging programs, since the error message of a compiler usually indicates in which line the error is located. Column commands can also be entered in this way. To tell the cursor to go to a specific row and column, type the row number and then the column number with a comma in between: This sequence moves the cursor to line 2 and column 6. Notice that with regard to the column number, the command is able to place the cursor in virtual territory. This is not true for line numbers. To test this, try issuing a command to move the cursor to line 12.

If you omit the line number entirely and just type, for example, the command `,6', the cursor will be placed in column 6 of whatever row it finds itself. If you want to find out the location of the cursor, follow the same procedure using the `=' command.

The column the cursor is in will be displayed just after the `:' symbol in the command line, followed by information about the position of the cursor relative to the end of the file as well as its precise location on the screen. For example, in our case, with the cursor on line 2 and in column 6, something like the following will appear on the command line (the number of bytes varies depending on how many tabs and spaces you may have typed):



\fbox{\makebox[12cm]{\tt    2 :   6 bytes=25/78
screen=2,6\hfill IA$\infty $NY B1${}^{\cdot} $HELLO.C }} Now let's make use of the '=' command to learn more about how virtual space is counted.

You will see that although virtual lines are not counted in the information displayed, virtual spaces are included in the column count. This combination is most natural for programming since one often needs to know the line number of a particular line; at the same time, certain languages (notably Fortran) are column-dependent, hence one must know which column the cursor is in and whether it is in virtual territory or not.
Command line commands for cursor movement
Action Desired Command to Use
Move cursor to line desired Type line #
Move cursor to row and column Row #,Column #
Move cursor to column on the ,Column #
same row  
Find location of cursor Type =