this power comes at a price, because regular
expressions are a bit tricky to specify.
In this section we mention only a few essential ones. More about search
patterns and commands can be found in chapter 27 |usr_27.txt|. You can find
the full explanation here: |pattern|.
BEGINNING AND END OF A LINE
The ^ character matches the beginning of a line. On an English-US keyboard
you find it above the 6. The pattern "include" matches the word include
anywhere on the line. But the pattern "^include" matches the word include
only if it is at the beginning of a line.
The $ character matches the end of a line. Therefore, "was$" matches the
word was only if it is at the end of a line.
Let's mark the places where "/the" matches in this example line with "x"s:
the solder holding one of the chips melted and the ~
xxx xxx xxx
Using "/the$" we find this match:
the solder holding one of the chips melted and the ~
xxx
And with "/^the" we find this one:
the solder holding one of the chips melted and the ~
xxx
You can try searching with "/^the$"; it will only match a single line
consisting entirely of "the". White space does matter here, thus if a line
contains a space after the word, like "the ", the pattern will not match.
MATCHING ANY SINGLE CHARACTER
The . (dot) character matches any existing character. For example, the
pattern "c.m" matches a string whose first character is a c, whose second
character is anything, and whose third character is m. Example:
We use a computer that became the cummin winter. ~
xxx xxx xxx
MATCHING SPECIAL CHARACTERS
If you really want to match a dot, you must avoid its special meaning by
putting a backslash before it.
If you search for "ter.", you will find these matches:
We use a computer that became the cummin winter. ~
xxxx xxxx
Searching for "ter\." only finds the second match.
==============================================================================
*03.10* Using marks
When you make a jump to a position with the "G" command, Vim remembers the
position from before this jump. This position is called a mark. To go back
where you came from, use this command: >
``
This ` is a backtick or open single-quote character.
If you use the same command a second time you will jump back again. That's
because the "`" command is a jump itself, and the position from before this
jump is remembered.
Generally, every time you do a command that can move the cursor further than
within the same line, this is called a jump. This includes the search
commands "/" and "n" (it doesn't matter how far away the match is). But not
the character searches with "fx" and "tx" or the word movements "w" and "e".
Also, "j" and "k" are not considered to be a jump,