Skip to content

Commit f9bbdee

Browse files
authored
Merge pull request #2064 from h-east/update-tagsrch
Update tagsrch.{txt,jax}
2 parents 8df0224 + 198bf72 commit f9bbdee

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

doc/tagsrch.jax

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*tagsrch.txt* For Vim バージョン 9.1. Last change: 2025 Apr 26
1+
*tagsrch.txt* For Vim バージョン 9.1. Last change: 2025 Apr 30
22

33

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

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

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

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

949+
function TagFunc(pattern, flags, info)
950950
let result = taglist(a:pattern)
951951
call sort(result, "CompareFilenames")
952952

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

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

en/tagsrch.txt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
22

33

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

896896
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.
899899

900900
The function used for generating the taglist is specified by setting the
901901
'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'.
950950
The following is a hypothetical example of a function used for 'tagfunc'. It
951951
uses the output of |taglist()| to generate the result: a list of tags in the
952952
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
961959

960+
function TagFunc(pattern, flags, info)
962961
let result = taglist(a:pattern)
963962
call sort(result, "CompareFilenames")
964963

965964
return result
966965
endfunc
967966
set tagfunc=TagFunc
968967
<
968+
Note: When executing |taglist()| the 'tagfunc' function won't be called
969+
recursively.
969970

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

0 commit comments

Comments
 (0)