1
- *usr_03.txt* For Vim version 8.1. Last change: 2017 Jul 21
1
+ *usr_03.txt* For Vim version 8.1. Last change: 2019 Nov 21
2
2
3
3
VIM USER MANUAL - by Bram Moolenaar
4
4
@@ -81,8 +81,8 @@ The "$" command moves the cursor to the end of a line. If your keyboard has
81
81
an <End> key it will do the same thing.
82
82
83
83
The "^" command moves to the first non-blank character of the line. The "0"
84
- command (zero) moves to the very first character of the line. The <Home> key
85
- does the same thing. In a picture:
84
+ command (zero) moves to the very first character of the line, and the <Home>
85
+ key does the same thing. In a picture:
86
86
87
87
^
88
88
<------------
@@ -221,7 +221,8 @@ you can see? This figure shows the three commands you can use:
221
221
L --> | text sample text |
222
222
+---------------------------+
223
223
224
- Hints: "H" stands for Home, "M" for Middle and "L" for Last.
224
+ Hints: "H" stands for Home, "M" for Middle and "L" for Last. Alternatively,
225
+ "H" for high, "M" for Middle and "L" for low.
225
226
226
227
==============================================================================
227
228
*03.6* Telling where you are
@@ -298,22 +299,22 @@ To scroll one line at a time use CTRL-E (scroll up) and CTRL-Y (scroll down).
298
299
Think of CTRL-E to give you one line Extra. (If you use MS-Windows compatible
299
300
key mappings CTRL-Y will redo a change instead of scroll.)
300
301
301
- To scroll forward by a whole screen (except for two lines) use CTRL-F . The
302
- other way is backward, CTRL-B is the command to use. Fortunately CTRL-F is
303
- Forward and CTRL-B is Backward, that's easy to remember .
302
+ To scroll forward by a whole screen (except for two lines) use CTRL-F . To
303
+ scroll backwards, use CTRL-B . These should be easy to remember: F for
304
+ Forwards and B for Backwards .
304
305
305
306
A common issue is that after moving down many lines with "j" your cursor is at
306
307
the bottom of the screen. You would like to see the context of the line with
307
308
the cursor. That's done with the "zz" command.
308
309
309
310
+------------------+ +------------------+
310
- | some text | | some text |
311
- | some text | | some text |
312
- | some text | | some text |
313
- | some text | zz --> | line with cursor |
314
- | some text | | some text |
315
- | some text | | some text |
316
- | line with cursor | | some text |
311
+ | earlier text | | earlier text |
312
+ | earlier text | | earlier text |
313
+ | earlier text | | earlier text |
314
+ | earlier text | zz --> | line with cursor |
315
+ | earlier text | | later text |
316
+ | earlier text | | later text |
317
+ | line with cursor | | later text |
317
318
+------------------+ +------------------+
318
319
319
320
The "zt" command puts the cursor line at the top, "zb" at the bottom. There
@@ -353,7 +354,7 @@ The "?" command works like "/" but searches backwards: >
353
354
354
355
The "N" command repeats the last search the opposite direction. Thus using
355
356
"N" after a "/" command searches backwards, using "N" after "?" searches
356
- forward .
357
+ forwards .
357
358
358
359
359
360
IGNORING CASE
@@ -462,8 +463,8 @@ really jump to that location. Or type more to change the search string.
462
463
:set nowrapscan
463
464
464
465
This stops the search at the end of the file. Or, when you are searching
465
- backwards, at the start of the file. The 'wrapscan' option is on by default,
466
- thus searching wraps around the end of the file.
466
+ backwards, it stops the search at the start of the file. The 'wrapscan'
467
+ option is on by default, thus searching wraps around the end of the file.
467
468
468
469
469
470
INTERMEZZO
@@ -485,7 +486,8 @@ Vim. Example: >
485
486
Go:set hlsearch<Esc>
486
487
487
488
"G" moves to the end of the file. "o" starts a new line, where you type the
488
- ":set" command. You end insert mode with <Esc> . Then write the file: >
489
+ ":set" command. You end insert mode with <Esc> . Then write and close the
490
+ file: >
489
491
490
492
ZZ
491
493
@@ -499,8 +501,8 @@ Regular expressions are an extremely powerful and compact way to specify a
499
501
search pattern. Unfortunately, this power comes at a price, because regular
500
502
expressions are a bit tricky to specify.
501
503
In this section we mention only a few essential ones. More about search
502
- patterns and commands in chapter 27 | usr_27.txt | . You can find the full
503
- explanation here: | pattern | .
504
+ patterns and commands can be found in chapter 27 | usr_27.txt | . You can find
505
+ the full explanation here: | pattern | .
504
506
505
507
506
508
BEGINNING AND END OF A LINE
@@ -526,9 +528,9 @@ And with "/^the" we find this one:
526
528
the solder holding one of the chips melted and the ~
527
529
xxx
528
530
529
- You can try searching with "/^the$", it will only match a single line
530
- consisting of "the". White space does matter here, thus if a line contains a
531
- space after the word, like "the ", the pattern will not match.
531
+ You can try searching with "/^the$"; it will only match a single line
532
+ consisting entirely of "the". White space does matter here, thus if a line
533
+ contains a space after the word, like "the ", the pattern will not match.
532
534
533
535
534
536
MATCHING ANY SINGLE CHARACTER
@@ -563,20 +565,20 @@ where you came from, use this command: >
563
565
564
566
This ` is a backtick or open single-quote character.
565
567
If you use the same command a second time you will jump back again. That's
566
- because the ` command is a jump itself, and the position from before this jump
567
- is remembered.
568
+ because the "`" command is a jump itself, and the position from before this
569
+ jump is remembered.
568
570
569
571
Generally, every time you do a command that can move the cursor further than
570
572
within the same line, this is called a jump. This includes the search
571
573
commands "/" and "n" (it doesn't matter how far away the match is). But not
572
574
the character searches with "fx" and "tx" or the word movements "w" and "e".
573
- Also, "j" and "k" are not considered to be a jump. Even when you use a
575
+ Also, "j" and "k" are not considered to be a jump, even when you use a
574
576
count to make them move the cursor quite a long way away.
575
577
576
- The `` command jumps back and forth, between two points. The CTRL-O command
578
+ The "``" command jumps back and forth, between two points. The CTRL-O command
577
579
jumps to older positions (Hint: O for older). CTRL-I then jumps back to newer
578
- positions (Hint: I is just next to O on the keyboard). Consider this sequence
579
- of commands: >
580
+ positions (Hint: for many common keyboard layouts, I is just next to O).
581
+ Consider this sequence of commands: >
580
582
581
583
33G
582
584
/^The
@@ -614,9 +616,9 @@ Thus to move to the a mark:
614
616
>
615
617
`a
616
618
617
- The command 'mark (single quotation mark, or apostrophe) moves you to the
618
- beginning of the line containing the mark. This differs from the `mark
619
- command, which moves you to marked column.
619
+ The command " 'mark" (single quotation mark, or apostrophe) moves you to the
620
+ beginning of the line containing the mark. This differs from the " `mark"
621
+ command, which also moves you to the marked column.
620
622
621
623
The marks can be very useful when working on two related parts in a file.
622
624
Suppose you have some text near the start of the file you need to look at,
0 commit comments