Skip to content

Update tagsrch.{txt,jax} #2064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions doc/tagsrch.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*tagsrch.txt* For Vim バージョン 9.1. Last change: 2025 Apr 26
*tagsrch.txt* For Vim バージョン 9.1. Last change: 2025 Apr 30


VIMリファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -885,8 +885,9 @@ CTRL-W d 新しいウィンドウを開き、カーソルの下にあったキ
==============================================================================
7. 'tagfunc' を使う *tag-function*

|:tag|、|:tselect| のようなコマンド、および |CTRL-]| のようなノーマルモードタ
グコマンドに使われるタグのリストを生成する関数をVimに提供することが可能である。
|:tag|、|:tselect| のようなコマンド、|CTRL-]| のようなノーマルモードのタグコマ
ンド、および |taglist()| 関数に使用されるタグのリストを生成する関数を Vim に提
供することができる。

タグリストの生成に使用される関数は、'tagfunc' オプションを設定することによって
指定される。関数は3つの引数で呼び出される:
Expand Down Expand Up @@ -938,21 +939,21 @@ Note フォーマットは |taglist()| のものと似ており、これによ

以下は、'tagfunc' に使用される関数の仮定の例である。結果(ファイル名の逆順のタ
グのリスト)を生成するために |taglist()| の出力を使用している。
>
function TagFunc(pattern, flags, info)
function CompareFilenames(item1, item2)
let f1 = a:item1['filename']
let f2 = a:item2['filename']
return f1 >=# f2 ?
\ -1 : f1 <=# f2 ? 1 : 0
endfunction
>vim
function CompareFilenames(item1, item2)
let f1 = a:item1['filename']
let f2 = a:item2['filename']
return f1 >=# f2 ? -1 : f1 <=# f2 ? 1 : 0
endfunction

function TagFunc(pattern, flags, info)
let result = taglist(a:pattern)
call sort(result, "CompareFilenames")

return result
endfunc
set tagfunc=TagFunc
<
Note: |taglist()| を実行すると、'tagfunc' 関数は再帰的に呼び出されない。

vim:tw=78:ts=8:noet:ft=help:norl:
23 changes: 12 additions & 11 deletions en/tagsrch.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*tagsrch.txt* For Vim version 9.1. Last change: 2025 Apr 26
*tagsrch.txt* For Vim version 9.1. Last change: 2025 Apr 30


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -894,8 +894,8 @@ Common arguments for the commands above:
7. Using 'tagfunc' *tag-function*

It is possible to provide Vim with a function which will generate a list of
tags used for commands like |:tag|, |:tselect| and Normal mode tag commands
like |CTRL-]|.
tags used for commands like |:tag|, |:tselect|, Normal mode tag commands like
|CTRL-]| and for the |taglist()| function.

The function used for generating the taglist is specified by setting the
'tagfunc' option. The function will be called with three arguments:
Expand Down Expand Up @@ -950,21 +950,22 @@ It is not allowed to close a window or change window from inside 'tagfunc'.
The following is a hypothetical example of a function used for 'tagfunc'. It
uses the output of |taglist()| to generate the result: a list of tags in the
inverse order of file names.
>
function TagFunc(pattern, flags, info)
function CompareFilenames(item1, item2)
let f1 = a:item1['filename']
let f2 = a:item2['filename']
return f1 >=# f2 ?
\ -1 : f1 <=# f2 ? 1 : 0
endfunction
>vim
function CompareFilenames(item1, item2)
let f1 = a:item1['filename']
let f2 = a:item2['filename']
return f1 >=# f2 ? -1 : f1 <=# f2 ? 1 : 0
endfunction

function TagFunc(pattern, flags, info)
let result = taglist(a:pattern)
call sort(result, "CompareFilenames")

return result
endfunc
set tagfunc=TagFunc
<
Note: When executing |taglist()| the 'tagfunc' function won't be called
recursively.

vim:tw=78:ts=8:noet:ft=help:norl: