Book HomeLearning the vi EditorSearch this book

2.5. Joining Two Lines with J

Figure Sometimes while editing a file you will end up with a series of short lines that are difficult to scan. When you want to merge two lines into one, position the cursor anywhere on the first line, and press J to join the two lines.

Suppose your file practice reads:

Figure 2.5
Keystrokes Results
J Figure

J joins the line the cursor is on with the line below.

. Figure

Repeat the last command (J) with the . to join the next line with the current line.

Using a numeric argument with J joins that number of consecutive lines. In the example above, you could have joined three lines by using the command 3J.

2.5.1. Problem Checklist



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.