A Practical Guide to UNIX for Mac OS X Users

This section describes three commands that do not fit naturally into any other groups.

Join

Join (J)

The J (Join) command joins the line below the current line to the end of the current line, inserting a SPACE between what was previously two lines and leaving the cursor on this SPACE. If the current line ends with a period, vim inserts two SPACEs.

You can always "unjoin" (break) a line into two lines by replacing the SPACE or SPACEs where you want to break the line with a RETURN.

Status

Status (CONTROL-G)

The Status command, CONTROL-G, displays the name of the file you are editing, information about whether the file has been modified, the total number of lines in the Work buffer, the percentage of the Work buffer preceding the current line, and the number of the line and character the cursor is on. You can also use :f to display status information. Following is a sample status line:

"memo.05" 17103 lines --3%-- 569,1 3%

. (Period)

The . (period) command repeats the most recent command that made a change. If you had just given a d2w command (delete the next two words), for example, the . command would delete the next two words. If you had just inserted text, the . command would repeat the insertion of the same text. This command is useful if you want to change some occurrences of a word or phrase in the Work buffer. Search for the first occurrence of the word (use /) and then make the change you want (use cw). You can then use n to search for the next occurrence of the word and . to make the same change to it. If you do not want to make the change, use n again to find the next occurrence.

Категории