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