|
3 | 3 | helpname: 'tagsrch'
|
4 | 4 | ---
|
5 | 5 | <div id='vimCodeElement'>
|
6 |
| -<a class="Constant" href="tagsrch.html" name="tagsrch.txt">tagsrch.txt</a> For <span class="Identifier">Vim バージョン 9.1.</span> Last change: 2025 Apr 26<br> |
| 6 | +<a class="Constant" href="tagsrch.html" name="tagsrch.txt">tagsrch.txt</a> For <span class="Identifier">Vim バージョン 9.1.</span> Last change: 2025 Apr 30<br> |
7 | 7 | <br>
|
8 | 8 | <br>
|
9 | 9 | <span class="Identifier">VIMリファレンスマニュアル by Bram Moolenaar</span><br>
|
|
890 | 890 | <span class="PreProc">==============================================================================</span><br>
|
891 | 891 | 7. <a class="Type" href="options.html#'tagfunc'">'tagfunc'</a> を使う <a class="Constant" href="tagsrch.html#tag-function" name="tag-function">tag-function</a><br>
|
892 | 892 | <br>
|
893 |
| -<a class="Identifier" href="tagsrch.html#:tag">:tag</a>、<a class="Identifier" href="tagsrch.html#:tselect">:tselect</a> のようなコマンド、および <a class="Identifier" href="tagsrch.html#CTRL-]">CTRL-]</a> のようなノーマルモードタ<br> |
894 |
| -グコマンドに使われるタグのリストを生成する関数をVimに提供することが可能である。<br> |
| 893 | +<a class="Identifier" href="tagsrch.html#:tag">:tag</a>、<a class="Identifier" href="tagsrch.html#:tselect">:tselect</a> のようなコマンド、<a class="Identifier" href="tagsrch.html#CTRL-]">CTRL-]</a> のようなノーマルモードのタグコマ<br> |
| 894 | +ンド、および <a class="Identifier" href="builtin.html#taglist()">taglist()</a> 関数に使用されるタグのリストを生成する関数を Vim に提<br> |
| 895 | +供することができる。<br> |
895 | 896 | <br>
|
896 | 897 | タグリストの生成に使用される関数は、<a class="Type" href="options.html#'tagfunc'">'tagfunc'</a> オプションを設定することによって<br>
|
897 | 898 | 指定される。関数は3つの引数で呼び出される:<br>
|
|
943 | 944 | <br>
|
944 | 945 | 以下は、<a class="Type" href="options.html#'tagfunc'">'tagfunc'</a> に使用される関数の仮定の例である。結果(ファイル名の逆順のタ<br>
|
945 | 946 | グのリスト)を生成するために <a class="Identifier" href="builtin.html#taglist()">taglist()</a> の出力を使用している。<br>
|
946 |
| -<br> |
947 |
| -<div class="helpExample"> function TagFunc(pattern, flags, info)<br> |
948 |
| - function CompareFilenames(item1, item2)<br> |
949 |
| - let f1 = a:item1['filename']<br> |
950 |
| - let f2 = a:item2['filename']<br> |
951 |
| - return f1 >=# f2 ?<br> |
952 |
| - \ -1 : f1 <=# f2 ? 1 : 0<br> |
953 |
| - endfunction</div> |
954 |
| -<br> |
955 |
| -<div class="helpExample"> let result = taglist(a:pattern)<br> |
956 |
| - call sort(result, "CompareFilenames")</div> |
957 |
| -<br> |
958 |
| -<div class="helpExample"> return result<br> |
| 947 | +>vim<br> |
| 948 | + function CompareFilenames(item1, item2)<br> |
| 949 | + let f1 = a:item1[<span class="MissingTag">'filename'</span>]<br> |
| 950 | + let f2 = a:item2[<span class="MissingTag">'filename'</span>]<br> |
| 951 | + return f1 >=# f2 ? -1 : f1 <=# f2 ? 1 : 0<br> |
| 952 | + endfunction<br> |
| 953 | +<br> |
| 954 | + function TagFunc(pattern, flags, info)<br> |
| 955 | + let result = taglist(a:pattern)<br> |
| 956 | + call sort(result, "CompareFilenames")<br> |
| 957 | +<br> |
| 958 | + return result<br> |
959 | 959 | endfunc<br>
|
960 |
| - set tagfunc=TagFunc</div> |
961 |
| -<br> |
| 960 | + set tagfunc=TagFunc<br> |
| 961 | +<<br> |
| 962 | +<span class="Todo">Note</span>: <a class="Identifier" href="builtin.html#taglist()">taglist()</a> を実行すると、<a class="Type" href="options.html#'tagfunc'">'tagfunc'</a> 関数は再帰的に呼び出されない。<br> |
962 | 963 | <br>
|
963 | 964 | vim:tw=78:ts=8:noet:ft=help:norl:<br>
|
964 | 965 | </div>
|
0 commit comments