Mercurial > vim
annotate runtime/doc/tagsrch.txt @ 9992:3e3b0ce24b61 v7.4.2269
commit https://github.com/vim/vim/commit/e17bdffff78ebd6a4e3cff26754cc667557ea810
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 27 18:34:29 2016 +0200
patch 7.4.2269
Problem: Using 'hlsearch' highlighting instead of matchpos if there is no
search match.
Solution: Pass NULL as last item to next_search_hl() when searching for
'hlsearch' match. (Shane Harper, closes #1013)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 27 Aug 2016 18:45:06 +0200 |
parents | 03fa8a51e9dc |
children | 9f48eab77d62 |
rev | line source |
---|---|
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
1 *tagsrch.txt* For Vim version 7.4. Last change: 2016 Aug 20 |
7 | 2 |
3 | |
4 VIM REFERENCE MANUAL by Bram Moolenaar | |
5 | |
6 | |
7 Tags and special searches *tags-and-searches* | |
8 | |
9 See section |29.1| of the user manual for an introduction. | |
10 | |
11 1. Jump to a tag |tag-commands| | |
12 2. Tag stack |tag-stack| | |
13 3. Tag match list |tag-matchlist| | |
14 4. Tags details |tag-details| | |
15 5. Tags file format |tags-file-format| | |
16 6. Include file searches |include-search| | |
17 | |
18 ============================================================================== | |
19 1. Jump to a tag *tag-commands* | |
20 | |
21 *tag* *tags* | |
22 A tag is an identifier that appears in a "tags" file. It is a sort of label | |
23 that can be jumped to. For example: In C programs each function name can be | |
24 used as a tag. The "tags" file has to be generated by a program like ctags, | |
25 before the tag commands can be used. | |
26 | |
27 With the ":tag" command the cursor will be positioned on the tag. With the | |
28 CTRL-] command, the keyword on which the cursor is standing is used as the | |
29 tag. If the cursor is not on a keyword, the first keyword to the right of the | |
30 cursor is used. | |
31 | |
32 The ":tag" command works very well for C programs. If you see a call to a | |
33 function and wonder what that function does, position the cursor inside of the | |
34 function name and hit CTRL-]. This will bring you to the function definition. | |
35 An easy way back is with the CTRL-T command. Also read about the tag stack | |
36 below. | |
37 | |
38 *:ta* *:tag* *E426* *E429* | |
685 | 39 :[count]ta[g][!] {ident} |
40 Jump to the definition of {ident}, using the | |
7 | 41 information in the tags file(s). Put {ident} in the |
42 tag stack. See |tag-!| for [!]. | |
43 {ident} can be a regexp pattern, see |tag-regexp|. | |
685 | 44 When there are several matching tags for {ident}, jump |
45 to the [count] one. When [count] is omitted the | |
46 first one is jumped to. See |tag-matchlist| for | |
47 jumping to other matching tags. | |
7 | 48 |
49 g<LeftMouse> *g<LeftMouse>* | |
50 <C-LeftMouse> *<C-LeftMouse>* *CTRL-]* | |
51 CTRL-] Jump to the definition of the keyword under the | |
52 cursor. Same as ":tag {ident}", where {ident} is the | |
685 | 53 keyword under or after cursor. |
54 When there are several matching tags for {ident}, jump | |
55 to the [count] one. When no [count] is given the | |
56 first one is jumped to. See |tag-matchlist| for | |
57 jumping to other matching tags. | |
58 {Vi: identifier after the cursor} | |
7 | 59 |
60 *v_CTRL-]* | |
61 {Visual}CTRL-] Same as ":tag {ident}", where {ident} is the text that | |
62 is highlighted. {not in Vi} | |
63 | |
64 *telnet-CTRL-]* | |
65 CTRL-] is the default telnet escape key. When you type CTRL-] to jump to a | |
66 tag, you will get the telnet prompt instead. Most versions of telnet allow | |
67 changing or disabling the default escape key. See the telnet man page. You | |
68 can 'telnet -E {Hostname}' to disable the escape character, or 'telnet -e | |
69 {EscapeCharacter} {Hostname}' to specify another escape character. If | |
56 | 70 possible, try to use "ssh" instead of "telnet" to avoid this problem. |
7 | 71 |
72 *tag-priority* | |
73 When there are multiple matches for a tag, this priority is used: | |
74 1. "FSC" A full matching static tag for the current file. | |
75 2. "F C" A full matching global tag for the current file. | |
76 3. "F " A full matching global tag for another file. | |
77 4. "FS " A full matching static tag for another file. | |
78 5. " SC" An ignore-case matching static tag for the current file. | |
79 6. " C" An ignore-case matching global tag for the current file. | |
80 7. " " An ignore-case matching global tag for another file. | |
81 8. " S " An ignore-case matching static tag for another file. | |
82 | |
83 Note that when the current file changes, the priority list is mostly not | |
84 changed, to avoid confusion when using ":tnext". It is changed when using | |
85 ":tag {ident}". | |
86 | |
9913
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
87 The ignore-case matches are not found for a ":tag" command when: |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
88 - the 'ignorecase' option is off and 'tagcase' is "followic" |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
89 - 'tagcase' is "match" |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
90 - 'tagcase' is "smart" and the pattern contains an upper case character. |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
91 - 'tagcase' is "followscs" and 'smartcase' option is on and the pattern |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
92 contains an upper case character. |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
93 |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
94 The gnore-case matches are found when: |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
95 - a pattern is used (starting with a "/") |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
96 - for ":tselect" |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
97 - when 'tagcase' is "followic" and 'ignorecase' is off |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
98 - when 'tagcase' is "match" |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
99 - when 'tagcase' is "followscs" and the 'smartcase' option is off |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
100 |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
101 Note that using ignore-case tag searching disables binary searching in the |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
102 tags file, which causes a slowdown. This can be avoided by fold-case sorting |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
103 the tag file. See the 'tagbsearch' option for an explanation. |
7 | 104 |
105 ============================================================================== | |
106 2. Tag stack *tag-stack* *tagstack* *E425* | |
107 | |
108 On the tag stack is remembered which tags you jumped to, and from where. | |
109 Tags are only pushed onto the stack when the 'tagstack' option is set. | |
110 | |
111 g<RightMouse> *g<RightMouse>* | |
112 <C-RightMouse> *<C-RightMouse>* *CTRL-T* | |
113 CTRL-T Jump to [count] older entry in the tag stack | |
114 (default 1). {not in Vi} | |
115 | |
116 *:po* *:pop* *E555* *E556* | |
117 :[count]po[p][!] Jump to [count] older entry in tag stack (default 1). | |
118 See |tag-!| for [!]. {not in Vi} | |
119 | |
120 :[count]ta[g][!] Jump to [count] newer entry in tag stack (default 1). | |
121 See |tag-!| for [!]. {not in Vi} | |
122 | |
123 *:tags* | |
124 :tags Show the contents of the tag stack. The active | |
125 entry is marked with a '>'. {not in Vi} | |
126 | |
127 The output of ":tags" looks like this: | |
128 | |
2681 | 129 # TO tag FROM line in file/text |
7 | 130 1 1 main 1 harddisk2:text/vim/test |
131 > 2 2 FuncA 58 i = FuncA(10); | |
132 3 1 FuncC 357 harddisk2:text/vim/src/amiga.c | |
133 | |
134 This list shows the tags that you jumped to and the cursor position before | |
135 that jump. The older tags are at the top, the newer at the bottom. | |
136 | |
137 The '>' points to the active entry. This is the tag that will be used by the | |
138 next ":tag" command. The CTRL-T and ":pop" command will use the position | |
139 above the active entry. | |
140 | |
141 Below the "TO" is the number of the current match in the match list. Note | |
142 that this doesn't change when using ":pop" or ":tag". | |
143 | |
144 The line number and file name are remembered to be able to get back to where | |
145 you were before the tag command. The line number will be correct, also when | |
146 deleting/inserting lines, unless this was done by another program (e.g. | |
147 another instance of Vim). | |
148 | |
2681 | 149 For the current file, the "file/text" column shows the text at the position. |
7 | 150 An indent is removed and a long line is truncated to fit in the window. |
151 | |
152 You can jump to previously used tags with several commands. Some examples: | |
153 | |
154 ":pop" or CTRL-T to position before previous tag | |
155 {count}CTRL-T to position before {count} older tag | |
156 ":tag" to newer tag | |
157 ":0tag" to last used tag | |
158 | |
159 The most obvious way to use this is while browsing through the call graph of | |
160 a program. Consider the following call graph: | |
161 | |
162 main ---> FuncA ---> FuncC | |
163 ---> FuncB | |
164 | |
165 (Explanation: main calls FuncA and FuncB; FuncA calls FuncC). | |
166 You can get from main to FuncA by using CTRL-] on the call to FuncA. Then | |
167 you can CTRL-] to get to FuncC. If you now want to go back to main you can | |
168 use CTRL-T twice. Then you can CTRL-] to FuncB. | |
169 | |
170 If you issue a ":ta {ident}" or CTRL-] command, this tag is inserted at the | |
171 current position in the stack. If the stack was full (it can hold up to 20 | |
172 entries), the oldest entry is deleted and the older entries shift one | |
173 position up (their index number is decremented by one). If the last used | |
174 entry was not at the bottom, the entries below the last used one are | |
175 deleted. This means that an old branch in the call graph is lost. After the | |
176 commands explained above the tag stack will look like this: | |
177 | |
2681 | 178 # TO tag FROM line in file/text |
179 1 1 main 1 harddisk2:text/vim/test | |
180 2 1 FuncB 59 harddisk2:text/vim/src/main.c | |
7 | 181 |
182 *E73* | |
183 When you try to use the tag stack while it doesn't contain anything you will | |
184 get an error message. | |
185 | |
186 ============================================================================== | |
187 3. Tag match list *tag-matchlist* *E427* *E428* | |
188 | |
189 When there are several matching tags, these commands can be used to jump | |
2033
de5a43c5eedc
Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
1702
diff
changeset
|
190 between them. Note that these commands don't change the tag stack, they keep |
7 | 191 the same entry. |
192 | |
193 *:ts* *:tselect* | |
194 :ts[elect][!] [ident] List the tags that match [ident], using the | |
195 information in the tags file(s). | |
196 When [ident] is not given, the last tag name from the | |
197 tag stack is used. | |
198 With a '>' in the first column is indicated which is | |
199 the current position in the list (if there is one). | |
200 [ident] can be a regexp pattern, see |tag-regexp|. | |
201 See |tag-priority| for the priorities used in the | |
202 listing. {not in Vi} | |
203 Example output: | |
204 | |
205 > | |
206 nr pri kind tag file | |
207 1 F f mch_delay os_amiga.c | |
208 mch_delay(msec, ignoreinput) | |
209 > 2 F f mch_delay os_msdos.c | |
210 mch_delay(msec, ignoreinput) | |
211 3 F f mch_delay os_unix.c | |
212 mch_delay(msec, ignoreinput) | |
213 Enter nr of choice (<CR> to abort): | |
214 < | |
215 See |tag-priority| for the "pri" column. Note that | |
216 this depends on the current file, thus using | |
217 ":tselect xxx" can produce different results. | |
218 The "kind" column gives the kind of tag, if this was | |
219 included in the tags file. | |
220 The "info" column shows information that could be | |
221 found in the tags file. It depends on the program | |
222 that produced the tags file. | |
223 When the list is long, you may get the |more-prompt|. | |
224 If you already see the tag you want to use, you can | |
225 type 'q' and enter the number. | |
226 | |
227 *:sts* *:stselect* | |
228 :sts[elect][!] [ident] Does ":tselect[!] [ident]" and splits the window for | |
229 the selected tag. {not in Vi} | |
230 | |
231 *g]* | |
232 g] Like CTRL-], but use ":tselect" instead of ":tag". | |
233 {not in Vi} | |
234 | |
235 *v_g]* | |
236 {Visual}g] Same as "g]", but use the highlighted text as the | |
237 identifier. {not in Vi} | |
238 | |
239 *:tj* *:tjump* | |
240 :tj[ump][!] [ident] Like ":tselect", but jump to the tag directly when | |
241 there is only one match. {not in Vi} | |
242 | |
243 *:stj* *:stjump* | |
244 :stj[ump][!] [ident] Does ":tjump[!] [ident]" and splits the window for the | |
245 selected tag. {not in Vi} | |
246 | |
247 *g_CTRL-]* | |
248 g CTRL-] Like CTRL-], but use ":tjump" instead of ":tag". | |
249 {not in Vi} | |
250 | |
251 *v_g_CTRL-]* | |
252 {Visual}g CTRL-] Same as "g CTRL-]", but use the highlighted text as | |
253 the identifier. {not in Vi} | |
254 | |
255 *:tn* *:tnext* | |
256 :[count]tn[ext][!] Jump to [count] next matching tag (default 1). See | |
257 |tag-!| for [!]. {not in Vi} | |
258 | |
259 *:tp* *:tprevious* | |
260 :[count]tp[revious][!] Jump to [count] previous matching tag (default 1). | |
261 See |tag-!| for [!]. {not in Vi} | |
262 | |
263 *:tN* *:tNext* | |
264 :[count]tN[ext][!] Same as ":tprevious". {not in Vi} | |
265 | |
266 *:tr* *:trewind* | |
267 :[count]tr[ewind][!] Jump to first matching tag. If [count] is given, jump | |
268 to [count]th matching tag. See |tag-!| for [!]. {not | |
269 in Vi} | |
270 | |
271 *:tf* *:tfirst* | |
237 | 272 :[count]tf[irst][!] Same as ":trewind". {not in Vi} |
7 | 273 |
274 *:tl* *:tlast* | |
275 :tl[ast][!] Jump to last matching tag. See |tag-!| for [!]. {not | |
276 in Vi} | |
277 | |
651 | 278 *:lt* *:ltag* |
279 :lt[ag][!] [ident] Jump to tag [ident] and add the matching tags to a new | |
280 location list for the current window. [ident] can be | |
281 a regexp pattern, see |tag-regexp|. When [ident] is | |
282 not given, the last tag name from the tag stack is | |
283 used. The search pattern to locate the tag line is | |
284 prefixed with "\V" to escape all the special | |
285 characters (very nomagic). The location list showing | |
286 the matching tags is independent of the tag stack. | |
287 See |tag-!| for [!]. | |
288 {not in Vi} | |
7 | 289 |
290 When there is no other message, Vim shows which matching tag has been jumped | |
291 to, and the number of matching tags: > | |
292 tag 1 of 3 or more | |
293 The " or more" is used to indicate that Vim didn't try all the tags files yet. | |
294 When using ":tnext" a few times, or with ":tlast", more matches may be found. | |
295 | |
296 When you didn't see this message because of some other message, or you just | |
297 want to know where you are, this command will show it again (and jump to the | |
298 same tag as last time): > | |
299 :0tn | |
300 < | |
301 *tag-skip-file* | |
302 When a matching tag is found for which the file doesn't exist, this match is | |
303 skipped and the next matching tag is used. Vim reports this, to notify you of | |
304 missing files. When the end of the list of matches has been reached, an error | |
305 message is given. | |
306 | |
651 | 307 *tag-preview* |
7 | 308 The tag match list can also be used in the preview window. The commands are |
309 the same as above, with a "p" prepended. | |
310 {not available when compiled without the |+quickfix| feature} | |
311 | |
312 *:pts* *:ptselect* | |
313 :pts[elect][!] [ident] Does ":tselect[!] [ident]" and shows the new tag in a | |
237 | 314 "Preview" window. See |:ptag| for more info. |
7 | 315 {not in Vi} |
316 | |
317 *:ptj* *:ptjump* | |
318 :ptj[ump][!] [ident] Does ":tjump[!] [ident]" and shows the new tag in a | |
237 | 319 "Preview" window. See |:ptag| for more info. |
7 | 320 {not in Vi} |
321 | |
322 *:ptn* *:ptnext* | |
323 :[count]ptn[ext][!] ":tnext" in the preview window. See |:ptag|. | |
324 {not in Vi} | |
325 | |
326 *:ptp* *:ptprevious* | |
327 :[count]ptp[revious][!] ":tprevious" in the preview window. See |:ptag|. | |
328 {not in Vi} | |
329 | |
330 *:ptN* *:ptNext* | |
331 :[count]ptN[ext][!] Same as ":ptprevious". {not in Vi} | |
332 | |
333 *:ptr* *:ptrewind* | |
334 :[count]ptr[ewind][!] ":trewind" in the preview window. See |:ptag|. | |
335 {not in Vi} | |
336 | |
337 *:ptf* *:ptfirst* | |
237 | 338 :[count]ptf[irst][!] Same as ":ptrewind". {not in Vi} |
7 | 339 |
340 *:ptl* *:ptlast* | |
341 :ptl[ast][!] ":tlast" in the preview window. See |:ptag|. | |
342 {not in Vi} | |
343 | |
344 ============================================================================== | |
345 4. Tags details *tag-details* | |
346 | |
347 *static-tag* | |
348 A static tag is a tag that is defined for a specific file. In a C program | |
349 this could be a static function. | |
350 | |
351 In Vi jumping to a tag sets the current search pattern. This means that | |
352 the "n" command after jumping to a tag does not search for the same pattern | |
353 that it did before jumping to the tag. Vim does not do this as we consider it | |
354 to be a bug. You can still find the tag search pattern in the search history. | |
355 If you really want the old Vi behavior, set the 't' flag in 'cpoptions'. | |
356 | |
357 *tag-binary-search* | |
358 Vim uses binary searching in the tags file to find the desired tag quickly | |
359 (when enabled at compile time |+tag_binary|). But this only works if the | |
360 tags file was sorted on ASCII byte value. Therefore, if no match was found, | |
361 another try is done with a linear search. If you only want the linear search, | |
362 reset the 'tagbsearch' option. Or better: Sort the tags file! | |
363 | |
364 Note that the binary searching is disabled when not looking for a tag with a | |
365 specific name. This happens when ignoring case and when a regular expression | |
366 is used that doesn't start with a fixed string. Tag searching can be a lot | |
367 slower then. The former can be avoided by case-fold sorting the tags file. | |
368 See 'tagbsearch' for details. | |
369 | |
370 *tag-regexp* | |
5244 | 371 The ":tag" and ":tselect" commands accept a regular expression argument. See |
7 | 372 |pattern| for the special characters that can be used. |
373 When the argument starts with '/', it is used as a pattern. If the argument | |
374 does not start with '/', it is taken literally, as a full tag name. | |
375 Examples: > | |
376 :tag main | |
377 < jumps to the tag "main" that has the highest priority. > | |
378 :tag /^get | |
379 < jumps to the tag that starts with "get" and has the highest priority. > | |
380 :tag /norm | |
381 < lists all the tags that contain "norm", including "id_norm". | |
382 When the argument both exists literally, and match when used as a regexp, a | |
383 literal match has a higher priority. For example, ":tag /open" matches "open" | |
384 before "open_file" and "file_open". | |
415 | 385 When using a pattern case is ignored. If you want to match case use "\C" in |
386 the pattern. | |
7 | 387 |
388 *tag-!* | |
389 If the tag is in the current file this will always work. Otherwise the | |
390 performed actions depend on whether the current file was changed, whether a ! | |
391 is added to the command and on the 'autowrite' option: | |
392 | |
393 tag in file autowrite ~ | |
394 current file changed ! option action ~ | |
395 ----------------------------------------------------------------------------- | |
396 yes x x x goto tag | |
397 no no x x read other file, goto tag | |
398 no yes yes x abandon current file, read other file, goto | |
399 tag | |
400 no yes no on write current file, read other file, goto | |
401 tag | |
402 no yes no off fail | |
403 ----------------------------------------------------------------------------- | |
404 | |
405 - If the tag is in the current file, the command will always work. | |
406 - If the tag is in another file and the current file was not changed, the | |
407 other file will be made the current file and read into the buffer. | |
408 - If the tag is in another file, the current file was changed and a ! is | |
409 added to the command, the changes to the current file are lost, the other | |
410 file will be made the current file and read into the buffer. | |
411 - If the tag is in another file, the current file was changed and the | |
412 'autowrite' option is on, the current file will be written, the other | |
413 file will be made the current file and read into the buffer. | |
414 - If the tag is in another file, the current file was changed and the | |
415 'autowrite' option is off, the command will fail. If you want to save | |
416 the changes, use the ":w" command and then use ":tag" without an argument. | |
417 This works because the tag is put on the stack anyway. If you want to lose | |
418 the changes you can use the ":tag!" command. | |
419 | |
420 *tag-security* | |
421 Note that Vim forbids some commands, for security reasons. This works like | |
422 using the 'secure' option for exrc/vimrc files in the current directory. See | |
423 |trojan-horse| and |sandbox|. | |
424 When the {tagaddress} changes a buffer, you will get a warning message: | |
425 "WARNING: tag command changed a buffer!!!" | |
426 In a future version changing the buffer will be impossible. All this for | |
427 security reasons: Somebody might hide a nasty command in the tags file, which | |
428 would otherwise go unnoticed. Example: > | |
429 :$d|/tag-function-name/ | |
237 | 430 {this security prevention is not present in Vi} |
7 | 431 |
432 In Vi the ":tag" command sets the last search pattern when the tag is searched | |
433 for. In Vim this is not done, the previous search pattern is still remembered, | |
434 unless the 't' flag is present in 'cpoptions'. The search pattern is always | |
435 put in the search history, so you can modify it if searching fails. | |
436 | |
437 *emacs-tags* *emacs_tags* *E430* | |
438 Emacs style tag files are only supported if Vim was compiled with the | |
439 |+emacs_tags| feature enabled. Sorry, there is no explanation about Emacs tag | |
440 files here, it is only supported for backwards compatibility :-). | |
441 | |
2033
de5a43c5eedc
Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
1702
diff
changeset
|
442 Lines in Emacs tags files can be very long. Vim only deals with lines of up |
de5a43c5eedc
Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
1702
diff
changeset
|
443 to about 510 bytes. To see whether lines are ignored set 'verbose' to 5 or |
de5a43c5eedc
Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
1702
diff
changeset
|
444 higher. |
de5a43c5eedc
Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
1702
diff
changeset
|
445 |
7 | 446 *tags-option* |
447 The 'tags' option is a list of file names. Each of these files is searched | |
448 for the tag. This can be used to use a different tags file than the default | |
449 file "tags". It can also be used to access a common tags file. | |
450 | |
451 The next file in the list is not used when: | |
452 - A matching static tag for the current buffer has been found. | |
453 - A matching global tag has been found. | |
9913
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
454 This also depends on whether case is ignored. Case is ignored when: |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
455 - 'tagcase' is "followic" and 'ignorecase' is set |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
456 - 'tagcase' is "ignore" |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
457 - 'tagcase' is "smart" and the pattern only contains lower case |
9913
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
458 characters. |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
459 - 'tagcase' is "followscs" and 'smartcase' is set and the pattern only |
9913
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
460 contains lower case characters. |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
461 If case is not ignored, and the tags file only has a match without matching |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
462 case, the next tags file is searched for a match with matching case. If no |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
463 tag with matching case is found, the first match without matching case is |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
464 used. If case is ignored, and a matching global tag with or without matching |
bb00c661b3a4
commit https://github.com/vim/vim/commit/66e29d7112e437b2b50efe1f82c7e892736d23e4
Christian Brabandt <cb@256bit.org>
parents:
7266
diff
changeset
|
465 case is found, this one is used, no further tags files are searched. |
7 | 466 |
467 When a tag file name starts with "./", the '.' is replaced with the path of | |
468 the current file. This makes it possible to use a tags file in the directory | |
469 where the current file is (no matter what the current directory is). The idea | |
470 of using "./" is that you can define which tag file is searched first: In the | |
471 current directory ("tags,./tags") or in the directory of the current file | |
472 ("./tags,tags"). | |
473 | |
474 For example: > | |
475 :set tags=./tags,tags,/home/user/commontags | |
476 | |
477 In this example the tag will first be searched for in the file "tags" in the | |
478 directory where the current file is. Next the "tags" file in the current | |
479 directory. If it is not found there, then the file "/home/user/commontags" | |
480 will be searched for the tag. | |
481 | |
482 This can be switched off by including the 'd' flag in 'cpoptions', to make | |
557 | 483 it Vi compatible. "./tags" will then be the tags file in the current |
7 | 484 directory, instead of the tags file in the directory where the current file |
485 is. | |
486 | |
487 Instead of the comma a space may be used. Then a backslash is required for | |
488 the space to be included in the string option: > | |
489 :set tags=tags\ /home/user/commontags | |
490 | |
491 To include a space in a file name use three backslashes. To include a comma | |
492 in a file name use two backslashes. For example, use: > | |
493 :set tags=tag\\\ file,/home/user/common\\,tags | |
494 | |
495 for the files "tag file" and "/home/user/common,tags". The 'tags' option will | |
496 have the value "tag\ file,/home/user/common\,tags". | |
497 | |
498 If the 'tagrelative' option is on (which is the default) and using a tag file | |
499 in another directory, file names in that tag file are relative to the | |
500 directory where the tag file is. | |
501 | |
502 ============================================================================== | |
503 5. Tags file format *tags-file-format* *E431* | |
504 | |
505 *ctags* *jtags* | |
506 A tags file can be created with an external command, for example "ctags". It | |
507 will contain a tag for each function. Some versions of "ctags" will also make | |
508 a tag for each "#defined" macro, typedefs, enums, etc. | |
509 | |
510 Some programs that generate tags files: | |
511 ctags As found on most Unix systems. Only supports C. Only | |
512 does the basic work. | |
20 | 513 *Exuberant_ctags* |
7 | 514 exuberant ctags This a very good one. It works for C, C++, Java, |
515 Fortran, Eiffel and others. It can generate tags for | |
516 many items. See http://ctags.sourceforge.net. | |
517 etags Connected to Emacs. Supports many languages. | |
518 JTags For Java, in Java. It can be found at | |
519 http://www.fleiner.com/jtags/. | |
520 ptags.py For Python, in Python. Found in your Python source | |
521 directory at Tools/scripts/ptags.py. | |
522 ptags For Perl, in Perl. It can be found at | |
523 http://www.eleves.ens.fr:8080/home/nthiery/Tags/. | |
524 gnatxref For Ada. See http://www.gnuada.org/. gnatxref is | |
525 part of the gnat package. | |
526 | |
527 | |
528 The lines in the tags file must have one of these three formats: | |
529 | |
530 1. {tagname} {TAB} {tagfile} {TAB} {tagaddress} | |
531 2. {tagfile}:{tagname} {TAB} {tagfile} {TAB} {tagaddress} | |
532 3. {tagname} {TAB} {tagfile} {TAB} {tagaddress} {term} {field} .. | |
533 | |
534 The first is a normal tag, which is completely compatible with Vi. It is the | |
535 only format produced by traditional ctags implementations. This is often used | |
536 for functions that are global, also referenced in other files. | |
537 | |
538 The lines in the tags file can end in <LF> or <CR><LF>. On the Macintosh <CR> | |
539 also works. The <CR> and <NL> characters can never appear inside a line. | |
540 | |
541 *tag-old-static* | |
542 The second format is for a static tag only. It is obsolete now, replaced by | |
543 the third format. It is only supported by Elvis 1.x and Vim and a few | |
544 versions of ctags. A static tag is often used for functions that are local, | |
545 only referenced in the file {tagfile}. Note that for the static tag, the two | |
546 occurrences of {tagfile} must be exactly the same. Also see |tags-option| | |
547 below, for how static tags are used. | |
548 | |
549 The third format is new. It includes additional information in optional | |
550 fields at the end of each line. It is backwards compatible with Vi. It is | |
551 only supported by new versions of ctags (such as Exuberant ctags). | |
552 | |
553 {tagname} The identifier. Normally the name of a function, but it can | |
554 be any identifier. It cannot contain a <Tab>. | |
555 {TAB} One <Tab> character. Note: previous versions allowed any | |
556 white space here. This has been abandoned to allow spaces in | |
557 {tagfile}. It can be re-enabled by including the | |
558 |+tag_any_white| feature at compile time. *tag-any-white* | |
559 {tagfile} The file that contains the definition of {tagname}. It can | |
560 have an absolute or relative path. It may contain environment | |
561 variables and wildcards (although the use of wildcards is | |
562 doubtful). It cannot contain a <Tab>. | |
563 {tagaddress} The Ex command that positions the cursor on the tag. It can | |
564 be any Ex command, although restrictions apply (see | |
565 |tag-security|). Posix only allows line numbers and search | |
566 commands, which are mostly used. | |
567 {term} ;" The two characters semicolon and double quote. This is | |
568 interpreted by Vi as the start of a comment, which makes the | |
569 following be ignored. This is for backwards compatibility | |
570 with Vi, it ignores the following fields. | |
571 {field} .. A list of optional fields. Each field has the form: | |
572 | |
573 <Tab>{fieldname}:{value} | |
574 | |
575 The {fieldname} identifies the field, and can only contain | |
576 alphabetical characters [a-zA-Z]. | |
577 The {value} is any string, but cannot contain a <Tab>. | |
578 These characters are special: | |
579 "\t" stands for a <Tab> | |
580 "\r" stands for a <CR> | |
581 "\n" stands for a <NL> | |
582 "\\" stands for a single '\' character | |
583 | |
584 There is one field that doesn't have a ':'. This is the kind | |
585 of the tag. It is handled like it was preceded with "kind:". | |
586 See the documentation of ctags for the kinds it produces. | |
587 | |
588 The only other field currently recognized by Vim is "file:" | |
589 (with an empty value). It is used for a static tag. | |
590 | |
591 The first lines in the tags file can contain lines that start with | |
592 !_TAG_ | |
593 These are sorted to the first lines, only rare tags that start with "!" can | |
594 sort to before them. Vim recognizes two items. The first one is the line | |
595 that indicates if the file was sorted. When this line is found, Vim uses | |
596 binary searching for the tags file: | |
597 !_TAG_FILE_SORTED<Tab>1<Tab>{anything} ~ | |
598 | |
7266
6ba7182fb7bd
commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents:
5400
diff
changeset
|
599 A tag file may be case-fold sorted to avoid a linear search when case is |
6ba7182fb7bd
commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents:
5400
diff
changeset
|
600 ignored. (Case is ignored when 'ignorecase' is set and 'tagcase' is |
6ba7182fb7bd
commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents:
5400
diff
changeset
|
601 "followic", or when 'tagcase' is "ignore".) See 'tagbsearch' for details. |
6ba7182fb7bd
commit https://github.com/vim/vim/commit/0f6562e9036f889185dff49a75c7fc5ffb28b307
Christian Brabandt <cb@256bit.org>
parents:
5400
diff
changeset
|
602 The value '2' should be used then: |
7 | 603 !_TAG_FILE_SORTED<Tab>2<Tab>{anything} ~ |
604 | |
605 The other tag that Vim recognizes, but only when compiled with the | |
606 |+multi_byte| feature, is the encoding of the tags file: | |
607 !_TAG_FILE_ENCODING<Tab>utf-8<Tab>{anything} ~ | |
608 Here "utf-8" is the encoding used for the tags. Vim will then convert the tag | |
609 being searched for from 'encoding' to the encoding of the tags file. And when | |
610 listing tags the reverse happens. When the conversion fails the unconverted | |
611 tag is used. | |
612 | |
613 *tag-search* | |
614 The command can be any Ex command, but often it is a search command. | |
615 Examples: | |
616 tag1 file1 /^main(argc, argv)/ ~ | |
617 tag2 file2 108 ~ | |
618 | |
619 The command is always executed with 'magic' not set. The only special | |
620 characters in a search pattern are "^" (begin-of-line) and "$" (<EOL>). | |
621 See |pattern|. Note that you must put a backslash before each backslash in | |
622 the search text. This is for backwards compatibility with Vi. | |
623 | |
624 *E434* *E435* | |
625 If the command is a normal search command (it starts and ends with "/" or | |
626 "?"), some special handling is done: | |
627 - Searching starts on line 1 of the file. | |
628 The direction of the search is forward for "/", backward for "?". | |
237 | 629 Note that 'wrapscan' does not matter, the whole file is always searched. (Vi |
630 does use 'wrapscan', which caused tags sometimes not be found.) {Vi starts | |
7 | 631 searching in line 2 of another file. It does not find a tag in line 1 of |
632 another file when 'wrapscan' is not set} | |
633 - If the search fails, another try is done ignoring case. If that fails too, | |
634 a search is done for: | |
635 "^tagname[ \t]*(" | |
636 (the tag with '^' prepended and "[ \t]*(" appended). When using function | |
637 names, this will find the function name when it is in column 0. This will | |
638 help when the arguments to the function have changed since the tags file was | |
639 made. If this search also fails another search is done with: | |
640 "^[#a-zA-Z_].*\<tagname[ \t]*(" | |
641 This means: A line starting with '#' or an identifier and containing the tag | |
642 followed by white space and a '('. This will find macro names and function | |
237 | 643 names with a type prepended. {the extra searches are not in Vi} |
7 | 644 |
645 ============================================================================== | |
646 6. Include file searches *include-search* *definition-search* | |
647 *E387* *E388* *E389* | |
648 | |
649 These commands look for a string in the current file and in all encountered | |
650 included files (recursively). This can be used to find the definition of a | |
651 variable, function or macro. If you only want to search in the current | |
652 buffer, use the commands listed at |pattern-searches|. | |
653 | |
654 These commands are not available when the |+find_in_path| feature was disabled | |
655 at compile time. | |
656 | |
657 When a line is encountered that includes another file, that file is searched | |
658 before continuing in the current buffer. Files included by included files are | |
659 also searched. When an include file could not be found it is silently | |
660 ignored. Use the |:checkpath| command to discover which files could not be | |
661 found, possibly your 'path' option is not set up correctly. Note: the | |
662 included file is searched, not a buffer that may be editing that file. Only | |
663 for the current file the lines in the buffer are used. | |
664 | |
665 The string can be any keyword or a defined macro. For the keyword any match | |
666 will be found. For defined macros only lines that match with the 'define' | |
667 option will be found. The default is "^#\s*define", which is for C programs. | |
668 For other languages you probably want to change this. See 'define' for an | |
669 example for C++. The string cannot contain an end-of-line, only matches | |
670 within a line are found. | |
671 | |
672 When a match is found for a defined macro, the displaying of lines continues | |
673 with the next line when a line ends in a backslash. | |
674 | |
675 The commands that start with "[" start searching from the start of the current | |
676 file. The commands that start with "]" start at the current cursor position. | |
677 | |
678 The 'include' option is used to define a line that includes another file. The | |
679 default is "\^#\s*include", which is for C programs. Note: Vim does not | |
680 recognize C syntax, if the 'include' option matches a line inside | |
681 "#ifdef/#endif" or inside a comment, it is searched anyway. The 'isfname' | |
682 option is used to recognize the file name that comes after the matched | |
683 pattern. | |
684 | |
685 The 'path' option is used to find the directory for the include files that | |
686 do not have an absolute path. | |
687 | |
688 The 'comments' option is used for the commands that display a single line or | |
689 jump to a line. It defines patterns that may start a comment. Those lines | |
690 are ignored for the search, unless [!] is used. One exception: When the line | |
691 matches the pattern "^# *define" it is not considered to be a comment. | |
692 | |
693 If you want to list matches, and then select one to jump to, you could use a | |
694 mapping to do that for you. Here is an example: > | |
695 | |
696 :map <F4> [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR> | |
697 < | |
698 *[i* | |
699 [i Display the first line that contains the keyword | |
700 under the cursor. The search starts at the beginning | |
701 of the file. Lines that look like a comment are | |
702 ignored (see 'comments' option). If a count is given, | |
703 the count'th matching line is displayed, and comment | |
704 lines are not ignored. {not in Vi} | |
705 | |
706 *]i* | |
707 ]i like "[i", but start at the current cursor position. | |
708 {not in Vi} | |
709 | |
710 *:is* *:isearch* | |
711 :[range]is[earch][!] [count] [/]pattern[/] | |
712 Like "[i" and "]i", but search in [range] lines | |
713 (default: whole file). | |
714 See |:search-args| for [/] and [!]. {not in Vi} | |
715 | |
716 *[I* | |
717 [I Display all lines that contain the keyword under the | |
718 cursor. Filenames and line numbers are displayed | |
719 for the found lines. The search starts at the | |
720 beginning of the file. {not in Vi} | |
721 | |
722 *]I* | |
723 ]I like "[I", but start at the current cursor position. | |
724 {not in Vi} | |
725 | |
726 *:il* *:ilist* | |
727 :[range]il[ist][!] [/]pattern[/] | |
728 Like "[I" and "]I", but search in [range] lines | |
729 (default: whole file). | |
730 See |:search-args| for [/] and [!]. {not in Vi} | |
731 | |
732 *[_CTRL-I* | |
733 [ CTRL-I Jump to the first line that contains the keyword | |
734 under the cursor. The search starts at the beginning | |
735 of the file. Lines that look like a comment are | |
736 ignored (see 'comments' option). If a count is given, | |
737 the count'th matching line is jumped to, and comment | |
738 lines are not ignored. {not in Vi} | |
739 | |
740 *]_CTRL-I* | |
741 ] CTRL-I like "[ CTRL-I", but start at the current cursor | |
742 position. {not in Vi} | |
743 | |
744 *:ij* *:ijump* | |
745 :[range]ij[ump][!] [count] [/]pattern[/] | |
746 Like "[ CTRL-I" and "] CTRL-I", but search in | |
747 [range] lines (default: whole file). | |
748 See |:search-args| for [/] and [!]. {not in Vi} | |
749 | |
750 CTRL-W CTRL-I *CTRL-W_CTRL-I* *CTRL-W_i* | |
751 CTRL-W i Open a new window, with the cursor on the first line | |
752 that contains the keyword under the cursor. The | |
753 search starts at the beginning of the file. Lines | |
754 that look like a comment line are ignored (see | |
755 'comments' option). If a count is given, the count'th | |
756 matching line is jumped to, and comment lines are not | |
757 ignored. {not in Vi} | |
758 | |
759 *:isp* *:isplit* | |
760 :[range]isp[lit][!] [count] [/]pattern[/] | |
761 Like "CTRL-W i" and "CTRL-W i", but search in | |
762 [range] lines (default: whole file). | |
763 See |:search-args| for [/] and [!]. {not in Vi} | |
764 | |
765 *[d* | |
766 [d Display the first macro definition that contains the | |
767 macro under the cursor. The search starts from the | |
768 beginning of the file. If a count is given, the | |
769 count'th matching line is displayed. {not in Vi} | |
770 | |
771 *]d* | |
772 ]d like "[d", but start at the current cursor position. | |
773 {not in Vi} | |
774 | |
775 *:ds* *:dsearch* | |
776 :[range]ds[earch][!] [count] [/]string[/] | |
777 Like "[d" and "]d", but search in [range] lines | |
778 (default: whole file). | |
779 See |:search-args| for [/] and [!]. {not in Vi} | |
780 | |
781 *[D* | |
782 [D Display all macro definitions that contain the macro | |
783 under the cursor. Filenames and line numbers are | |
784 displayed for the found lines. The search starts | |
785 from the beginning of the file. {not in Vi} | |
786 | |
787 *]D* | |
788 ]D like "[D", but start at the current cursor position. | |
789 {not in Vi} | |
790 | |
169 | 791 *:dli* *:dlist* |
3224 | 792 :[range]dli[st][!] [/]string[/] |
5400 | 793 Like `[D` and `]D`, but search in [range] lines |
7 | 794 (default: whole file). |
795 See |:search-args| for [/] and [!]. {not in Vi} | |
5400 | 796 Note that `:dl` works like `:delete` with the "l" |
797 flag, not `:dlist`. | |
7 | 798 |
799 *[_CTRL-D* | |
800 [ CTRL-D Jump to the first macro definition that contains the | |
801 keyword under the cursor. The search starts from | |
802 the beginning of the file. If a count is given, the | |
803 count'th matching line is jumped to. {not in Vi} | |
804 | |
805 *]_CTRL-D* | |
806 ] CTRL-D like "[ CTRL-D", but start at the current cursor | |
807 position. {not in Vi} | |
808 | |
809 *:dj* *:djump* | |
810 :[range]dj[ump][!] [count] [/]string[/] | |
811 Like "[ CTRL-D" and "] CTRL-D", but search in | |
812 [range] lines (default: whole file). | |
813 See |:search-args| for [/] and [!]. {not in Vi} | |
814 | |
815 CTRL-W CTRL-D *CTRL-W_CTRL-D* *CTRL-W_d* | |
816 CTRL-W d Open a new window, with the cursor on the first | |
817 macro definition line that contains the keyword | |
818 under the cursor. The search starts from the | |
819 beginning of the file. If a count is given, the | |
820 count'th matching line is jumped to. {not in Vi} | |
821 | |
822 *:dsp* *:dsplit* | |
823 :[range]dsp[lit][!] [count] [/]string[/] | |
824 Like "CTRL-W d", but search in [range] lines | |
825 (default: whole file). | |
826 See |:search-args| for [/] and [!]. {not in Vi} | |
827 | |
828 *:che* *:checkpath* | |
829 :che[ckpath] List all the included files that could not be found. | |
830 {not in Vi} | |
831 | |
832 :che[ckpath]! List all the included files. {not in Vi} | |
833 | |
834 *:search-args* | |
835 Common arguments for the commands above: | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
836 [!] When included, find matches in lines that are recognized as comments. |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
837 When excluded, a match is ignored when the line is recognized as a |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
838 comment (according to 'comments'), or the match is in a C comment |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
839 (after "//" or inside /* */). Note that a match may be missed if a |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
840 line is recognized as a comment, but the comment ends halfway the line. |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
841 And if the line is a comment, but it is not recognized (according to |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
842 'comments') a match may be found in it anyway. Example: > |
7 | 843 /* comment |
844 foobar */ | |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
845 < A match for "foobar" is found, because this line is not recognized as |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
846 a comment (even though syntax highlighting does recognize it). |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
847 Note: Since a macro definition mostly doesn't look like a comment, the |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
848 [!] makes no difference for ":dlist", ":dsearch" and ":djump". |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
849 [/] A pattern can be surrounded by '/'. Without '/' only whole words are |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
850 matched, using the pattern "\<pattern\>". Only after the second '/' a |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
851 next command can be appended with '|'. Example: > |
7 | 852 :isearch /string/ | echo "the last one" |
9975
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
853 < For a ":djump", ":dsplit", ":dlist" and ":dsearch" command the pattern |
03fa8a51e9dc
commit https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Christian Brabandt <cb@256bit.org>
parents:
9913
diff
changeset
|
854 is used as a literal string, not as a search pattern. |
7 | 855 |
856 vim:tw=78:ts=8:ft=help:norl: |