annotate runtime/doc/usr_03.txt @ 34864:3f9d9ee5cb7c v9.1.0299

patch 9.1.0299: Vim9: return type not set for a lambda assigned to script var Commit: https://github.com/vim/vim/commit/7f5202143b2c84ec12e709272d90dd79621d14ca Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Wed Apr 10 17:18:19 2024 +0200 patch 9.1.0299: Vim9: return type not set for a lambda assigned to script var Problem: Vim9: return type not set for a lambda assigned to script var (Ernie Rael) Solution: Correctly determine the return type (Yegappan Lakshmanan) fixes: #14445 closes: #14473 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Wed, 10 Apr 2024 17:30:04 +0200
parents 4635e43f2c6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
34057
4635e43f2c6f patch 9.1.0000: Vim 9.1 release
Christian Brabandt <cb@256bit.org>
parents: 32294
diff changeset
1 *usr_03.txt* For Vim version 9.1. Last change: 2023 Mar 13
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 VIM USER MANUAL - by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 Moving around
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 Before you can insert or delete text the cursor has to be moved to the right
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 place. Vim has a large number of commands to position the cursor. This
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 chapter shows you how to use the most important ones. You can find a list of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 these commands below |Q_lr|.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 |03.1| Word movement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 |03.2| Moving to the start or end of a line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 |03.3| Moving to a character
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 7
diff changeset
16 |03.4| Matching a parenthesis
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 |03.5| Moving to a specific line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 |03.6| Telling where you are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 |03.7| Scrolling around
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 |03.8| Simple searches
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 |03.9| Simple search patterns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 |03.10| Using marks
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 Next chapter: |usr_04.txt| Making small changes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 Previous chapter: |usr_02.txt| The first steps in Vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 Table of contents: |usr_toc.txt|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 *03.1* Word movement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 To move the cursor forward one word, use the "w" command. Like most Vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 commands, you can use a numeric prefix to move past multiple words. For
22171
d4c7b3e9cd17 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
33 example, "3w" moves three words. This figure shows how it works (starting at
d4c7b3e9cd17 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
34 the position marked with "x"):
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 This is a line with example text ~
22171
d4c7b3e9cd17 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
37 x-->-->->----------------->
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 w w w 3w
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 Notice that "w" moves to the start of the next word if it already is at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 start of a word.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 The "b" command moves backward to the start of the previous word:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 This is a line with example text ~
22171
d4c7b3e9cd17 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
45 <----<--<-<---------<--x
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 b b b 2b b
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 There is also the "e" command that moves to the next end of a word and "ge",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 which moves to the previous end of a word:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 This is a line with example text ~
22171
d4c7b3e9cd17 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
52 <----<----x---->------------>
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22171
diff changeset
53 2ge ge e 2e
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 If you are at the last word of a line, the "w" command will take you to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 first word in the next line. Thus you can use this to move through a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 paragraph, much faster than using "l". "b" does the same in the other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 direction.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 A word ends at a non-word character, such as a ".", "-" or ")". To change
7384
aea5ebf352c4 commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents: 6530
diff changeset
61 what Vim considers to be a word, see the 'iskeyword' option. If you try this
aea5ebf352c4 commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents: 6530
diff changeset
62 out in the help directly, 'iskeyword' needs to be reset for the examples to
aea5ebf352c4 commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents: 6530
diff changeset
63 work: >
aea5ebf352c4 commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents: 6530
diff changeset
64 :set iskeyword&
aea5ebf352c4 commit https://github.com/vim/vim/commit/256972a9849b5d575b62a6a71be5b6934b5b0e8b
Christian Brabandt <cb@256bit.org>
parents: 6530
diff changeset
65 It is also possible to move by white-space separated WORDs. This is not a
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 word in the normal sense, that's why the uppercase is used. The commands for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 moving by WORDs are also uppercase, as this figure shows:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 ge b w e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 <- <- ---> --->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 This is-a line, with special/separated/words (and some more). ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 <----- <----- --------------------> ----->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 gE B W E
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 With this mix of lowercase and uppercase commands, you can quickly move
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 forward and backward through a paragraph.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 *03.2* Moving to the start or end of a line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 The "$" command moves the cursor to the end of a line. If your keyboard has
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 an <End> key it will do the same thing.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 The "^" command moves to the first non-blank character of the line. The "0"
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
85 command (zero) moves to the very first character of the line, and the <Home>
22171
d4c7b3e9cd17 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
86 key does the same thing. In a picture ("." indicates a space):
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 ^
22171
d4c7b3e9cd17 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
89 <-----------x
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 .....This is a line with example text ~
22171
d4c7b3e9cd17 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19574
diff changeset
91 <----------------x x-------------->
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 0 $
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 (the "....." indicates blanks here)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 The "$" command takes a count, like most movement commands. But moving to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 the end of the line several times doesn't make sense. Therefore it causes the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 editor to move to the end of another line. For example, "1$" moves you to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 the end of the first line (the one you're on), "2$" to the end of the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 line, and so on.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 The "0" command doesn't take a count argument, because the "0" would be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 part of the count. Unexpectedly, using a count with "^" doesn't have any
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 effect.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 *03.3* Moving to a character
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 One of the most useful movement commands is the single-character search
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 command. The command "fx" searches forward in the line for the single
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 character x. Hint: "f" stands for "Find".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 For example, you are at the beginning of the following line. Suppose you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 want to go to the h of human. Just execute the command "fh" and the cursor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 will be positioned over the h:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 To err is human. To really foul up you need a computer. ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 ---------->--------------->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 fh fy
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 This also shows that the command "fy" moves to the end of the word really.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 You can specify a count; therefore, you can go to the "l" of "foul" with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 "3fl":
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 To err is human. To really foul up you need a computer. ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 --------------------->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 3fl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 The "F" command searches to the left:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 To err is human. To really foul up you need a computer. ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 <---------------------
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 Fh
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 The "tx" command works like the "fx" command, except it stops one character
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 before the searched character. Hint: "t" stands for "To". The backward
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 version of this command is "Tx".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 To err is human. To really foul up you need a computer. ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 <------------ ------------->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 Th tn
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 These four commands can be repeated with ";". "," repeats in the other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 direction. The cursor is never moved to another line. Not even when the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 sentence continues.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 Sometimes you will start a search, only to realize that you have typed the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 wrong command. You type "f" to search backward, for example, only to realize
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 that you really meant "F". To abort a search, press <Esc>. So "f<Esc>" is an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 aborted forward search and doesn't do anything. Note: <Esc> cancels most
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 operations, not just searches.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 ==============================================================================
164
8b0ee9d57d7f updated for version 7.0050
vimboss
parents: 7
diff changeset
152 *03.4* Matching a parenthesis
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 When writing a program you often end up with nested () constructs. Then the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 "%" command is very handy: It moves to the matching paren. If the cursor is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 on a "(" it will move to the matching ")". If it's on a ")" it will move to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 the matching "(".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 %
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 <----->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 if (a == (b * c) / d) ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 <---------------->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 %
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 This also works for [] and {} pairs. (This can be defined with the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 'matchpairs' option.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 When the cursor is not on a useful character, "%" will search forward to find
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 one. Thus if the cursor is at the start of the line of the previous example,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 "%" will search forward and find the first "(". Then it moves to its match:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 if (a == (b * c) / d) ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 ---+---------------->
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 %
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175
32294
b2e8663e6dcc Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 31028
diff changeset
176 Other ways to move around code can be found in |usr_29.txt|.
b2e8663e6dcc Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 31028
diff changeset
177
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 *03.5* Moving to a specific line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 If you are a C or C++ programmer, you are familiar with error messages such as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 the following:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 prog.c:33: j undeclared (first use in this function) ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 This tells you that you might want to fix something on line 33. So how do you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 find line 33? One way is to do "9999k" to go to the top of the file and "32j"
10895
c391bfbdb452 Updated runtime files.
Christian Brabandt <cb@256bit.org>
parents: 10198
diff changeset
188 to go down thirty-two lines. It is not a good way, but it works. A much
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 better way of doing things is to use the "G" command. With a count, this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 command positions you at the given line number. For example, "33G" puts you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 on line 33. (For a better way of going through a compiler's error list, see
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 |usr_30.txt|, for information on the :make command.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 With no argument, "G" positions you at the end of the file. A quick way to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 go to the start of a file use "gg". "1G" will do the same, but is a tiny bit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 more typing.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 | first line of a file ^
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 | text text text text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 | text text text text | gg
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 7G | text text text text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 | text text text text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 | text text text text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 V text text text text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 text text text text | G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 text text text text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 last line of a file V
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 Another way to move to a line is using the "%" command with a count. For
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 example "50%" moves you to halfway the file. "90%" goes to near the end.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 The previous assumes that you want to move to a line in the file, no matter if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 it's currently visible or not. What if you want to move to one of the lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 you can see? This figure shows the three commands you can use:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 +---------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 H --> | text sample text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 | sample text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 | text sample text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 | sample text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 M --> | text sample text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 | sample text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 | text sample text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 | sample text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 L --> | text sample text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 +---------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
227 Hints: "H" stands for Home, "M" for Middle and "L" for Last. Alternatively,
31028
5acd6f02ea35 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29314
diff changeset
228 "H" for High, "M" for Middle and "L" for Low.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 *03.6* Telling where you are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 To see where you are in a file, there are three ways:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 1. Use the CTRL-G command. You get a message like this (assuming the 'ruler'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 option is off):
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 "usr_03.txt" line 233 of 650 --35%-- col 45-52 ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 This shows the name of the file you are editing, the line number where the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 cursor is, the total number of lines, the percentage of the way through
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 the file and the column of the cursor.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 Sometimes you will see a split column number. For example, "col 2-9".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 This indicates that the cursor is positioned on the second character, but
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 because character one is a tab, occupying eight spaces worth of columns,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 the screen column is 9.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 2. Set the 'number' option. This will display a line number in front of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 every line: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 :set number
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 To switch this off again: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 :set nonumber
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 Since 'number' is a boolean option, prepending "no" to its name has the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 effect of switching it off. A boolean option has only these two values,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 it is either on or off.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 Vim has many options. Besides the boolean ones there are options with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 a numerical value and string options. You will see examples of this where
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 they are used.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 3. Set the 'ruler' option. This will display the cursor position in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 lower right corner of the Vim window: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 :set ruler
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 Using the 'ruler' option has the advantage that it doesn't take much room,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 thus there is more space for your text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 *03.7* Scrolling around
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 The CTRL-U command scrolls down half a screen of text. Think of looking
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 through a viewing window at the text and moving this window up by half the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 height of the window. Thus the window moves up over the text, which is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 backward in the file. Don't worry if you have a little trouble remembering
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 which end is up. Most users have the same problem.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 The CTRL-D command moves the viewing window down half a screen in the file,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 thus scrolls the text up half a screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 +----------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 | some text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 | some text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 | some text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 +---------------+ | some text |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 | some text | CTRL-U --> | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 | | | 123456 |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 | 123456 | +----------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 | 7890 |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 | | +----------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 | example | CTRL-D --> | 7890 |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 +---------------+ | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 | example |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 | example |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 | example |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 | example |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 +----------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 To scroll one line at a time use CTRL-E (scroll up) and CTRL-Y (scroll down).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 Think of CTRL-E to give you one line Extra. (If you use MS-Windows compatible
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 key mappings CTRL-Y will redo a change instead of scroll.)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
305 To scroll forward by a whole screen (except for two lines) use CTRL-F. To
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
306 scroll backwards, use CTRL-B. These should be easy to remember: F for
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
307 Forwards and B for Backwards.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 A common issue is that after moving down many lines with "j" your cursor is at
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 the bottom of the screen. You would like to see the context of the line with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 the cursor. That's done with the "zz" command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 +------------------+ +------------------+
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
314 | earlier text | | earlier text |
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
315 | earlier text | | earlier text |
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
316 | earlier text | | earlier text |
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
317 | earlier text | zz --> | line with cursor |
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
318 | earlier text | | later text |
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
319 | earlier text | | later text |
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
320 | line with cursor | | later text |
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 +------------------+ +------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 The "zt" command puts the cursor line at the top, "zb" at the bottom. There
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 are a few more scrolling commands, see |Q_sc|. To always keep a few lines of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 context around the cursor, use the 'scrolloff' option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 *03.8* Simple searches
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 To search for a string, use the "/string" command. To find the word include,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 for example, use the command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 /include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 You will notice that when you type the "/" the cursor jumps to the last line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 of the Vim window, like with colon commands. That is where you type the word.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 You can press the backspace key (backarrow or <BS>) to make corrections. Use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 the <Left> and <Right> cursor keys when necessary.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 Pressing <Enter> executes the command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 Note:
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 164
diff changeset
342 The characters .*[]^%/\?~$ have special meanings. If you want to use
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 them in a search you must put a \ in front of them. See below.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 To find the next occurrence of the same string use the "n" command. Use this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 to find the first #include after the cursor: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 /#include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 And then type "n" several times. You will move to each #include in the text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 You can also use a count if you know which match you want. Thus "3n" finds
19574
d4deb2e50667 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
352 the third match. You can also use a count with "/": "4/the" goes to the
d4deb2e50667 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
353 fourth match of "the".
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 The "?" command works like "/" but searches backwards: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 ?word
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 The "N" command repeats the last search the opposite direction. Thus using
11763
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 10895
diff changeset
360 "N" after a "/" command searches backwards, using "N" after "?" searches
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
361 forwards.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 IGNORING CASE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 Normally you have to type exactly what you want to find. If you don't care
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 about upper or lowercase in a word, set the 'ignorecase' option: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 :set ignorecase
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 If you now search for "word", it will also match "Word" and "WORD". To match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 case again: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 :set noignorecase
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 HISTORY
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 Suppose you do three searches: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 /one
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 /two
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 /three
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 Now let's start searching by typing a simple "/" without pressing <Enter>. If
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 you press <Up> (the cursor key), Vim puts "/three" on the command line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 Pressing <Enter> at this point searches for three. If you do not press
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 <Enter>, but press <Up> instead, Vim changes the prompt to "/two". Another
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 press of <Up> moves you to "/one".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 You can also use the <Down> cursor key to move through the history of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 search commands in the other direction.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 If you know what a previously used pattern starts with, and you want to use it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 again, type that character before pressing <Up>. With the previous example,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 you can type "/o<Up>" and Vim will put "/one" on the command line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 The commands starting with ":" also have a history. That allows you to recall
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 a previous command and execute it again. These two histories are separate.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 SEARCHING FOR A WORD IN THE TEXT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 Suppose you see the word "TheLongFunctionName" in the text and you want to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 find the next occurrence of it. You could type "/TheLongFunctionName", but
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 that's a lot of typing. And when you make a mistake Vim won't find it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 There is an easier way: Position the cursor on the word and use the "*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 command. Vim will grab the word under the cursor and use it as the search
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 string.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 The "#" command does the same in the other direction. You can prepend a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 count: "3*" searches for the third occurrence of the word under the cursor.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 SEARCHING FOR WHOLE WORDS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 If you type "/the" it will also match "there". To only find words that end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 in "the" use: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 /the\>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 The "\>" item is a special marker that only matches at the end of a word.
7557
502ca0a62fd8 commit https://github.com/vim/vim/commit/acb4f221c715a333f4c49a2235a8006c6ac6e4d5
Christian Brabandt <cb@256bit.org>
parents: 7384
diff changeset
421 Similarly "\<" only matches at the beginning of a word. Thus to search for
502ca0a62fd8 commit https://github.com/vim/vim/commit/acb4f221c715a333f4c49a2235a8006c6ac6e4d5
Christian Brabandt <cb@256bit.org>
parents: 7384
diff changeset
422 the word "the" only: >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 /\<the\>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 This does not match "there" or "soothe". Notice that the "*" and "#" commands
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 use these start-of-word and end-of-word markers to only find whole words (you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 can use "g*" and "g#" to match partial words).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 HIGHLIGHTING MATCHES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 While editing a program you see a variable called "nr". You want to check
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 where it's used. You could move the cursor to "nr" and use the "*" command
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 and press "n" to go along all the matches.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 There is another way. Type this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 :set hlsearch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 If you now search for "nr", Vim will highlight all matches. That is a very
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 good way to see where the variable is used, without the need to type commands.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 To switch this off: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 :set nohlsearch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 Then you need to switch it on again if you want to use it for the next search
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 command. If you only want to remove the highlighting, use this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 :nohlsearch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 This doesn't reset the option. Instead, it disables the highlighting. As
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 soon as you execute a search command, the highlighting will be used again.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 Also for the "n" and "N" commands.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 TUNING SEARCHES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 There are a few options that change how searching works. These are the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 essential ones:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 :set incsearch
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 This makes Vim display the match for the string while you are still typing it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 Use this to check if the right match will be found. Then press <Enter> to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 really jump to that location. Or type more to change the search string.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 :set nowrapscan
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 This stops the search at the end of the file. Or, when you are searching
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
470 backwards, it stops the search at the start of the file. The 'wrapscan'
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
471 option is on by default, thus searching wraps around the end of the file.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 INTERMEZZO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476 If you like one of the options mentioned before, and set it each time you use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477 Vim, you can put the command in your Vim startup file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 Edit the file, as mentioned at |not-compatible|. Or use this command to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 find out where it is: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 :scriptnames
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 Edit the file, for example with: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 :edit ~/.vimrc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487 Then add a line with the command to set the option, just like you typed it in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 Vim. Example: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 Go:set hlsearch<Esc>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492 "G" moves to the end of the file. "o" starts a new line, where you type the
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
493 ":set" command. You end insert mode with <Esc>. Then write and close the
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
494 file: >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496 ZZ
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498 If you now start Vim again, the 'hlsearch' option will already be set.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 *03.9* Simple search patterns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 The Vim editor uses regular expressions to specify what to search for.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 Regular expressions are an extremely powerful and compact way to specify a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 search pattern. Unfortunately, this power comes at a price, because regular
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 expressions are a bit tricky to specify.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 In this section we mention only a few essential ones. More about search
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
508 patterns and commands can be found in chapter 27 |usr_27.txt|. You can find
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
509 the full explanation here: |pattern|.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512 BEGINNING AND END OF A LINE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 The ^ character matches the beginning of a line. On an English-US keyboard
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 you find it above the 6. The pattern "include" matches the word include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
516 anywhere on the line. But the pattern "^include" matches the word include
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517 only if it is at the beginning of a line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518 The $ character matches the end of a line. Therefore, "was$" matches the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519 word was only if it is at the end of a line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520
11763
21f3930dfe6e Documentation updates.
Christian Brabandt <cb@256bit.org>
parents: 10895
diff changeset
521 Let's mark the places where "/the" matches in this example line with "x"s:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 the solder holding one of the chips melted and the ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 xxx xxx xxx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
525
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
526 Using "/the$" we find this match:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
527
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
528 the solder holding one of the chips melted and the ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529 xxx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531 And with "/^the" we find this one:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
532 the solder holding one of the chips melted and the ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
533 xxx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
534
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
535 You can try searching with "/^the$"; it will only match a single line
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
536 consisting entirely of "the". White space does matter here, thus if a line
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
537 contains a space after the word, like "the ", the pattern will not match.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540 MATCHING ANY SINGLE CHARACTER
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 The . (dot) character matches any existing character. For example, the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543 pattern "c.m" matches a string whose first character is a c, whose second
6530
435956324539 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5294
diff changeset
544 character is anything, and whose third character is m. Example:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 We use a computer that became the cummin winter. ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 xxx xxx xxx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550 MATCHING SPECIAL CHARACTERS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 If you really want to match a dot, you must avoid its special meaning by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553 putting a backslash before it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 If you search for "ter.", you will find these matches:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 We use a computer that became the cummin winter. ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 xxxx xxxx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 Searching for "ter\." only finds the second match.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 *03.10* Using marks
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 When you make a jump to a position with the "G" command, Vim remembers the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565 position from before this jump. This position is called a mark. To go back
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566 where you came from, use this command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568 ``
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 This ` is a backtick or open single-quote character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 If you use the same command a second time you will jump back again. That's
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
572 because the "`" command is a jump itself, and the position from before this
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
573 jump is remembered.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575 Generally, every time you do a command that can move the cursor further than
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576 within the same line, this is called a jump. This includes the search
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577 commands "/" and "n" (it doesn't matter how far away the match is). But not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578 the character searches with "fx" and "tx" or the word movements "w" and "e".
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
579 Also, "j" and "k" are not considered to be a jump, even when you use a
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580 count to make them move the cursor quite a long way away.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
582 The "``" command jumps back and forth, between two points. The CTRL-O command
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 jumps to older positions (Hint: O for older). CTRL-I then jumps back to newer
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
584 positions (Hint: for many common keyboard layouts, I is just next to O).
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
585 Consider this sequence of commands: >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 33G
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588 /^The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 CTRL-O
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591 You first jump to line 33, then search for a line that starts with "The".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 Then with CTRL-O you jump back to line 33. Another CTRL-O takes you back to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593 where you started. If you now use CTRL-I you jump to line 33 again. And
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594 to the match for "The" with another CTRL-I.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
596
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597 | example text ^ |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598 33G | example text | CTRL-O | CTRL-I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599 | example text | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600 V line 33 text ^ V
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 | example text | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602 /^The | example text | CTRL-O | CTRL-I
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603 V There you are | V
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604 example text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606 Note:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607 CTRL-I is the same as <Tab>.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609 The ":jumps" command gives a list of positions you jumped to. The entry which
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 you used last is marked with a ">".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612
255
c8742c8da9ab updated for version 7.0070
vimboss
parents: 236
diff changeset
613 NAMED MARKS *bookmark*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 Vim enables you to place your own marks in the text. The command "ma" marks
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616 the place under the cursor as mark a. You can place 26 marks (a through z) in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 your text. You can't see them, it's just a position that Vim remembers.
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 874
diff changeset
618 To go to a mark, use the command `{mark}, where {mark} is the mark letter.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 Thus to move to the a mark:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620 >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
621 `a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622
18719
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
623 The command "'mark" (single quotation mark, or apostrophe) moves you to the
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
624 beginning of the line containing the mark. This differs from the "`mark"
99586852c2db Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 14519
diff changeset
625 command, which also moves you to the marked column.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 The marks can be very useful when working on two related parts in a file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 Suppose you have some text near the start of the file you need to look at,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 while working on some text near the end of the file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
630 Move to the text at the start and place the s (start) mark there: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 ms
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 874
diff changeset
634 Then move to the text you want to work on and put the e (end) mark there: >
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 me
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 Now you can move around, and when you want to look at the start of the file,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639 you use this to jump there: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641 's
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 Then you can use '' to jump back to where you were, or 'e to jump to the text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 you were working on at the end.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 There is nothing special about using s for start and e for end, they are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 just easy to remember.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648 You can use this command to get a list of marks: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650 :marks
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 You will notice a few special marks. These include:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 ' The cursor position before doing a jump
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655 " The cursor position when last editing the file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 [ Start of the last change
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657 ] End of the last change
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661 Next chapter: |usr_04.txt| Making small changes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662
14519
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13963
diff changeset
663 Copyright: see |manual-copyright| vim:tw=78:ts=8:noet:ft=help:norl: