New Motion Commands
Vim provides all vi movement or motion commands, most of which are listed in Chapter 3, and adds several others, summarized in Table 10-1.
Command | Description |
<C-End> | Go to the end of the file, i.e., the last character of the last line of the file. If a count is given, go to the last character of the line count. |
<C-Home> | Go to the first nonwhitespace character of the first
line of the file. This differs from <C-End> because <C-Home> does not move the
cursor to whitespace. |
count % | Go to the line count percent
into the file, putting the cursor on the first nonblank line.
It’s important to note that Vim bases its calculation on the
number of lines in the file, not the total character count.
This may not seem important, but consider an example of a file
containing 200 lines, of which the first 195 contain 5
characters (for example, prices such as (195 * (5 + 1)) (The number of characters in the first 5-character lines) + 2 + (4 * (1000 + 1)) (The number of characters in the 1,000-character lines) or 5,200 characters. A true 50% count would place the cursor on line 96, and Vim’s 50% motion command would place the cursor on line 100. |
| Go to the |
Visual Mode Motion
Vim lets users define selections visually ...
Get Learning the vi and Vim Editors, 7th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.