|
1 |
| -*tagsrch.txt* For Vim version 9.1. Last change: 2025 Apr 26 |
| 1 | +*tagsrch.txt* For Vim version 9.1. Last change: 2025 Apr 30 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar
|
@@ -894,8 +894,8 @@ Common arguments for the commands above:
|
894 | 894 | 7. Using 'tagfunc' *tag-function*
|
895 | 895 |
|
896 | 896 | It is possible to provide Vim with a function which will generate a list of
|
897 |
| -tags used for commands like |:tag|, |:tselect| and Normal mode tag commands |
898 |
| -like |CTRL-]|. |
| 897 | +tags used for commands like |:tag|, |:tselect|, Normal mode tag commands like |
| 898 | +|CTRL-]| and for the |taglist()| function. |
899 | 899 |
|
900 | 900 | The function used for generating the taglist is specified by setting the
|
901 | 901 | 'tagfunc' option. The function will be called with three arguments:
|
@@ -950,21 +950,22 @@ It is not allowed to close a window or change window from inside 'tagfunc'.
|
950 | 950 | The following is a hypothetical example of a function used for 'tagfunc'. It
|
951 | 951 | uses the output of |taglist()| to generate the result: a list of tags in the
|
952 | 952 | inverse order of file names.
|
953 |
| -> |
954 |
| - function TagFunc(pattern, flags, info) |
955 |
| - function CompareFilenames(item1, item2) |
956 |
| - let f1 = a:item1['filename'] |
957 |
| - let f2 = a:item2['filename'] |
958 |
| - return f1 >=# f2 ? |
959 |
| - \ -1 : f1 <=# f2 ? 1 : 0 |
960 |
| - endfunction |
| 953 | +>vim |
| 954 | + function CompareFilenames(item1, item2) |
| 955 | + let f1 = a:item1['filename'] |
| 956 | + let f2 = a:item2['filename'] |
| 957 | + return f1 >=# f2 ? -1 : f1 <=# f2 ? 1 : 0 |
| 958 | + endfunction |
961 | 959 |
|
| 960 | + function TagFunc(pattern, flags, info) |
962 | 961 | let result = taglist(a:pattern)
|
963 | 962 | call sort(result, "CompareFilenames")
|
964 | 963 |
|
965 | 964 | return result
|
966 | 965 | endfunc
|
967 | 966 | set tagfunc=TagFunc
|
968 | 967 | <
|
| 968 | +Note: When executing |taglist()| the 'tagfunc' function won't be called |
| 969 | +recursively. |
969 | 970 |
|
970 | 971 | vim:tw=78:ts=8:noet:ft=help:norl:
|
0 commit comments