diff --git a/doc/options.jax b/doc/options.jax index 2393dfdba..5f5dafb57 100644 --- a/doc/options.jax +++ b/doc/options.jax @@ -1,4 +1,4 @@ -*options.txt* For Vim バージョン 9.1. Last change: 2025 Apr 08 +*options.txt* For Vim バージョン 9.1. Last change: 2025 Apr 30 VIMリファレンスマニュアル by Bram Moolenaar @@ -235,7 +235,7 @@ Termcap オプションを設定するには、{option} に "t_xx" の形式を :set makeprg=make,file 結果は "make,file" :set makeprg=make\\,file 結果は "make\,file" :set tags=tags,file 結果は "tags" と "file" - :set tags=tags\\,file 結果は "tags,file" + :set tags=tags\\,file 結果は "tags\,file" :let &tags='tags\,file' (同上) 文字 "|" によって、コマンド ":set" を後に続くコマンドと分けることができる。文 @@ -2127,6 +2127,27 @@ Note 1番目の形式では、行全体がオプション指定に使われる 前またはマクロを検索 |i_CTRL-X_CTRL-D| ] タグ補完 t "]" と同じ + f{func} 関数 {func} を呼び出す。複数の "f" フラグを指定できる。どう関 + 数が呼び出されるかと戻り値の詳細については、 + |complete-functions| を参照。値は関数名または |Funcref| を指定 + できる。|Funcref| 値の場合、スペースはバックスラッシュ('\')で、 + コンマは 2 つのバックスラッシュ ('\\') でエスケープする必要があ + る (|option-backslash| を参照)。 + {func} によって返される Dict に {"refresh": "always"} が含まれ + る場合、先頭のテキストが変更されるたびに関数が再度呼び出され + る。 + a:findstart が 1 の場合、{func} によって返される列に関係なく補 + 完マッチは常にキーワード境界に挿入される。これにより、他の補完 + ソースとの互換性が確保される。 + 挿入されたテキストをさらに変更するには、{func} で + |CompleteDonePre| を使用できる。 + マッチの生成が遅くなる可能性がある場合は、ブロックを避けてエ + ディタの応答性を保つために、|complete_check()| を使用するべき + である。 + f 'completefunc' オプションから取得した関数を使って "f{func}" を + 使用するのと同じである。 + o 'omnifunc' オプションから取得した関数を使って "f{func}" を使用 + するのと同じである。 読み込まれていないバッファでは、何しろ読み込まれていないのだから、 |:autocmd| は実行されていない。そのため、ある種のファイルからは思いも @@ -2146,6 +2167,13 @@ Note 1番目の形式では、行全体がオプション指定に使われる きる (つまり辞書 |i_CTRL-X_CTRL-K|、インクルードされるパターン |i_CTRL-X_CTRL-I|、タグ |i_CTRL-X_CTRL-]| および通常の展開)。 + 補完ソースのフラグにキャレット ("^") と {count} を付加することで、補完 + ソースに任意のマッチ数制限を指定できる。 + 例えば、".^9,w,u,t^5" は、カレントバッファからのマッチ数を 9 個まで、 + タグからのマッチ数を 5 個までに制限する。その他の補完元は無制限である。 + Note: マッチ数制限は前方補完 (CTRL-N) 時にのみ有効で、後方補完 (CTRL-P) + 時には無視される。 + *'completefunc'* *'cfu'* 'completefunc' 'cfu' 文字列 (既定では空) バッファについてローカル @@ -2224,6 +2252,12 @@ Note 1番目の形式では、行全体がオプション指定に使われる ついて付加的な情報があるときに便利である。例えば、それがど のファイルに含まれているかなど。 + nearest マッチ項目はカーソル位置からの距離に基づいてリストされ、デ + フォルトの動作であるカーソル下に表示されるマッチのみ近さを + 考慮する方法とは異なる。これはカレントバッファ内のマッチ項 + 目にのみ適用される。"fuzzy" が指定されている場合は効果がな + い。 + noinsert いかなるマッチしたテキストも、ユーザーがメニューから選択し ない限り挿入しない。"menu" か "menuone" と組み合わせたとき にだけ機能する。"longest" が指定された場合には、なんの影響 @@ -3643,6 +3677,7 @@ Note 1番目の形式では、行全体がオプション指定に使われる lastline '@' 'display' が含む最終行/切り捨て trunc '>' |ins-completion-menu| 内の切り捨てられ たテキスト + truncrl '<' 'rightleft' モードの "trunc" と同じ 指定されなかったキーワードについては、既定値が使われる。 @@ -3667,6 +3702,7 @@ Note 1番目の形式では、行全体がオプション指定に使われる lastline NonText |hl-NonText| trunc |hl-PmenuSel| のような多くのポップアップメニューハイラ イトグループの 1 つ。 + truncrl "trunc" と同じ *'findfunc'* *'ffu'* *E1514* 'findfunc' 'ffu' 文字列 (既定では "") @@ -4853,7 +4889,7 @@ Note 1番目の形式では、行全体がオプション指定に使われる コマンド |gf| でも、ファイルの実際の名前が見つからないときは、これが使 われる。プログラミング言語の 'include' 文の後で "gf" を使えるようにな る。 - また || にも使われる。 + Note: || では使用されない。 式が s: か || で始まる場合、スクリプトID(|local-function|) に置き 換えられる。例: > @@ -4990,6 +5026,22 @@ Note 1番目の形式では、行全体がオプション指定に使われる 文字があるならば、補完される部分もみな大文字になる。 'noinfercase' にすると、マッチした単語がそのまま挿入される。 + *'isexpand'* *'ise'* +'isexpand' 'ise' 文字列 (既定では "") + バッファについてローカル + 挿入モードで補完する文字とパターンを定義する。|complete_match()| 関数 + で補完の開始位置を決定するために使用される。これはコンマ区切りのトリ + ガーのリストである。各トリガーは以下のいずれかになる: + - "." や "/" のような単一の文字 + - "->"、"/*" または "/**" のような文字のシーケンス + + Note: トリガー文字としてリテラルのコンマを追加するには、"\\," を使用す + る。|option-backslash| を参照。 + + 例: > + set isexpand=.,->,/*,\\, +< + *'insertmode'* *'im'* *'noinsertmode'* *'noim'* 'insertmode' 'im' 切替 (既定ではオフ) グローバル @@ -8507,11 +8559,12 @@ Note 1番目の形式では、行全体がオプション指定に使われる 'tagfunc' 'tfu' 文字列 (既定では "") バッファについてローカル {|+eval| 機能付きでコンパイルされたときのみ有効} - このオプションは、タグ検索を実行するために使用される関数を指定する。こ - の関数はタグパターンを取得し、一致するタグのリストを返さなければならな - い。|tag-function| を参照。関数の書き方と例の説明がある。値として関数 - 名、|lambda|、|Funcref| が使える。詳細は |option-value-function| を参 - 照。 + このオプションは、タグ検索 (|taglist()| を含む) を実行するために使用さ + れる関数を指定する。 + この関数はタグパターンを取得し、一致するタグのリストを返さなければなら + ない。|tag-function| を参照。関数の書き方と例の説明がある。値として関 + 数名、|lambda|、|Funcref| が使える。詳細は |option-value-function| を + 参照。 セキュリティ上の理由から、このオプションを |modeline| または |sandbox| 内で設定することはできない。 @@ -9668,53 +9721,62 @@ Note 1番目の形式では、行全体がオプション指定に使われる *'wildmode'* *'wim'* 'wildmode' 'wim' 文字列 (Vimの既定値は "full") グローバル - オプション 'wildchar' で指定されたキーで開始する補完モード。値は、キー - ワードの4個までのコンマ区切りのリストである。それぞれのキーワードで、 - 連続して 'wildchar' を使ったときの動作を指定する。1個目のキーワードが - 'wildchar' を1回目に使ったときの動作を指定し、2個目のキーワードが2回目 - の動作を指定、等となる。 - - 各部分はコロンで区切られたリストで次の可能な値で構成される: - "" 最初のマッチのみを補完する。 - "full" 次のマッチを完全に補完する。最後のマッチの次には元の文 - 字列が使われ、その次は再び最初のマッチが補完される。 - 'wildmenu' が有効ならばそれも開始する。 - "longest" 共通する最長の文字列までが補完される。それ以上長い文字 - 列を補完できないときは、次の候補に移る。 - "list" 複数のマッチがあるときは、全てのマッチを羅列する。 - "lastused" バッファ名が補完され1より多くマッチした時、バッファを - 最終利用時刻でソートする (カレントバッファ以外)。 - "noselect" 最初のメニュー項目を事前に選択せず、有効な場合は - 'wildmenu' を開始する。 - マッチするものが 1 つしかない場合は、"noselect" が存在する場合を除き、 - すべてのケースで完全に補完される。 - - コロン区切りで利用できる例: - "longest:full" "longest" と似ているが、'wildmenu' が有効ならばそれも - 開始する。次の完全なマッチを補完しない。 - "list:full" 複数のマッチがあるときは、全てのマッチを羅列し、最初の - マッチを補完する。 - "list:longest" 複数のマッチがあるときは、全てのマッチを羅列し、共通す - る最長の文字列までが補完される。 - "list:lastused" 複数のバッファが一致する場合、一致する全バッファを最終 - 利用時刻でソートし羅列する (カレントバッファ以外)。 + 'wildchar' で指定された文字に使用される補完モード。このオプションは最 + 大 4 つの部分からなるコンマ区切りのリストで、それぞれ 'wildchar' の 1 + 回目、2 回目、3 回目および 4 回目の押下に対応する。各部分はコロンで区 + 切られた補完動作のリストで、それぞれのフェーズで同時に適用される。 + + 可能な動作値は以下の通り: + "" 最初のマッチだけを補完 (挿入) する。それ以降のマッチは + 繰り返されたりリストされたりしない。 + "full" 次の完全なマッチを補完する。すべてのマッチを順に巡り、 + 最後のマッチの後は元の入力に戻る。'wildmenu' が有効に + なっている場合は、それが表示される。 + "longest" 最長共通の部分文字列まで補完する。これで入力が拡張され + ない場合は、次の 'wildmode' 部分が使用される。 + "list" 複数のマッチが見つかった場合は、すべてをリストする。 + "lastused" バッファ名を補完する際、最近使用した順に並べ替える (カ + レントバッファを除く)。バッファ名の補完にのみ適用され + る。 + "noselect" 'wildmenu' が有効な場合、メニューは表示されるが、最初 + の項目は事前に選択されない。 + マッチするものが 1 つしかない場合は、"noselect" が指定されていない限り + 完全に補完される。 + + コロンで区切られた値の便利な組み合わせの例: + "longest:full" 最長共通の文字列から開始し、 'wildmenu' (有効 + な場合) を表示する。完全マッチは循環しない。 + "list:full" すべてのマッチをリストし、最初のマッチを補完す + る。 + "list:longest" すべてのマッチをリストし、最長の共通プリフィッ + クスまで補完する。 + "list:lastused" すべてのマッチをリストする。バッファを補完する + ときに、最近使用した順に並べ替える (カレント + バッファを除く)。 + "noselect:lastused" 'wildmenu' がアクティブな場合、最初の項目を事 + 前に選択しない。バッファを補完する際、最近使用 + した順に並べ替える (カレントバッファは除く)。 例: > :set wildmode=full -< 最初のマッチ、次のマッチ...を完全に補完する (既定値) > +< 押下のたびに完全マッチを補完する (デフォルトの動作) > :set wildmode=longest,full -< 共通する最長の文字列を補完し、次からマッチを完全に補完する > +< 1 回目の押下: 最長共通の部分文字列 + 2 回目の押下: 完全マッチを順に切り替える > :set wildmode=list:full -< 全てのマッチを羅列し、そして最初のマッチを完全に補完する > +< 1 回目の押下: すべてのマッチをリストし、最初の項目を補完する > :set wildmode=list,full -< 補完せずに全てのマッチを羅列し、次からマッチを完全に補完する > +< 1 回目の押下: マッチのみをリストする + 2 回目の押下: 完全マッチを補完する > :set wildmode=longest,list -< 共通する最長の文字列を補完し、次から他の候補を羅列する > +< 1 回目の押下: 最長共通の部分文字列 + 2 回目の押下: すべてのマッチをリストする > :set wildmode=noselect:full -< 補完せずに 'wildmenu' を表示し、次に各完全マッチを表示する > +< 1 回目の押下: 補完も選択もせずに 'wildmenu' を表示 + 2 回目の押下: 完全マッチを循環する > :set wildmode=noselect:lastused,full -< 上記と同じだが、バッファを最後に使用した時間でソートする。 - より詳しくは |cmdline-completion| を参照。 +< 上記と同じだが、バッファのマッチは最後に使用された時間でソートされる + 詳細はこちら: |cmdline-completion|。 *'wildoptions'* *'wop'* 'wildoptions' 'wop' 文字列 (既定では "") diff --git a/en/options.txt b/en/options.txt index 8530196aa..6c60b5896 100644 --- a/en/options.txt +++ b/en/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 9.1. Last change: 2025 Apr 08 +*options.txt* For Vim version 9.1. Last change: 2025 Apr 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -212,7 +212,7 @@ A few examples: > :set makeprg=make,file results in "make,file" :set makeprg=make\\,file results in "make\,file" :set tags=tags,file results in "tags" and "file" - :set tags=tags\\,file results in "tags,file" + :set tags=tags\\,file results in "tags\,file" :let &tags='tags\,file' (same as above) The "|" character separates a ":set" command from a following command. To @@ -2085,6 +2085,28 @@ A jump table for the options with a short description can be found at |Q_op|. |i_CTRL-X_CTRL-D| ] tag completion t same as "]" + f{func} call the function {func}. Multiple "f" flags may be specified. + Refer to |complete-functions| for details on how the function + is invoked and what it should return. The value can be the + name of a function or a |Funcref|. For |Funcref| values, + spaces must be escaped with a backslash ('\'), and commas with + double backslashes ('\\') (see |option-backslash|). + If the Dict returned by the {func} includes {"refresh": "always"}, + the function will be invoked again whenever the leading text + changes. + Completion matches are always inserted at the keyword + boundary, regardless of the column returned by {func} when + a:findstart is 1. This ensures compatibility with other + completion sources. + To make further modifications to the inserted text, {func} + can make use of |CompleteDonePre|. + If generating matches is potentially slow, |complete_check()| + should be used to avoid blocking and preserve editor + responsiveness. + f equivalent to using "f{func}", where the function is taken from + the 'completefunc' option. + o equivalent to using "f{func}", where the function is taken from + the 'omnifunc' option. Unloaded buffers are not loaded, thus their autocmds |:autocmd| are not executed, this may lead to unexpected completions from some files @@ -2103,6 +2125,13 @@ A jump table for the options with a short description can be found at |Q_op|. based expansion (e.g., dictionary |i_CTRL-X_CTRL-K|, included patterns |i_CTRL-X_CTRL-I|, tags |i_CTRL-X_CTRL-]| and normal expansions). + An optional match limit can be specified for a completion source by + appending a caret ("^") followed by a {count} to the source flag. + For example: ".^9,w,u,t^5" limits matches from the current buffer + to 9 and from tags to 5. Other sources remain unlimited. + Note: The match limit takes effect only during forward completion + (CTRL-N) and is ignored during backward completion (CTRL-P). + *'completefunc'* *'cfu'* 'completefunc' 'cfu' string (default: empty) local to buffer @@ -2179,6 +2208,12 @@ A jump table for the options with a short description can be found at |Q_op|. Useful when there is additional information about the match, e.g., what file it comes from. + nearest Matches are listed based on their proximity to the cursor + position, unlike the default behavior, which only + considers proximity for matches appearing below the + cursor. This applies only to matches from the current + buffer. No effect if "fuzzy" is present. + noinsert Do not insert any text for a match until the user selects a match from the menu. Only works in combination with "menu" or "menuone". No effect if "longest" is present. @@ -3621,6 +3656,7 @@ A jump table for the options with a short description can be found at |Q_op|. lastline '@' 'display' contains lastline/truncate trunc '>' truncated text in the |ins-completion-menu|. + truncrl '<' same as "trunc" in 'rightleft' mode Any one that is omitted will fall back to the default. @@ -3645,6 +3681,7 @@ A jump table for the options with a short description can be found at |Q_op|. lastline NonText |hl-NonText| trunc one of the many Popup menu highlighting groups like |hl-PmenuSel| + truncrl same as "trunc" *'findfunc'* *'ffu'* *E1514* 'findfunc' 'ffu' string (default empty) @@ -4808,7 +4845,7 @@ A jump table for the options with a short description can be found at |Q_op|. < Also used for the |gf| command if an unmodified file name can't be found. Allows doing "gf" on the name after an 'include' statement. - Also used for ||. + Note: Not used for ||. If the expression starts with s: or ||, then it is replaced with the script ID (|local-function|). Example: > @@ -4946,6 +4983,23 @@ A jump table for the options with a short description can be found at |Q_op|. and there is a letter before it, the completed part is made uppercase. With 'noinfercase' the match is used as-is. + *'isexpand'* *'ise'* +'isexpand' 'ise' string (default: "") + local to buffer + Defines characters and patterns for completion in insert mode. Used + by the |complete_match()| function to determine the starting position + for completion. This is a comma-separated list of triggers. Each + trigger can be: + - A single character like "." or "/" + - A sequence of characters like "->", "/*", or "/**" + + Note: Use "\\," to add a literal comma as trigger character, see + |option-backslash|. + + Examples: > + set isexpand=.,->,/*,\\, +< + *'insertmode'* *'im'* *'noinsertmode'* *'noim'* 'insertmode' 'im' boolean (default off) global @@ -8467,7 +8521,8 @@ A jump table for the options with a short description can be found at |Q_op|. local to buffer {not available when compiled without the |+eval| feature} - This option specifies a function to be used to perform tag searches. + This option specifies a function to be used to perform tag searches + (including |taglist()|). The function gets the tag pattern and should return a List of matching tags. See |tag-function| for an explanation of how to write the function and an example. The value can be the name of a function, a @@ -9638,55 +9693,65 @@ A jump table for the options with a short description can be found at |Q_op|. *'wildmode'* *'wim'* 'wildmode' 'wim' string (Vim default: "full") global - Completion mode that is used for the character specified with - 'wildchar'. It is a comma-separated list of up to four parts. Each - part specifies what to do for each consecutive use of 'wildchar'. The - first part specifies the behavior for the first use of 'wildchar', - The second part for the second use, etc. - - Each part consists of a colon separated list consisting of the - following possible values: - "" Complete only the first match. - "full" Complete the next full match. After the last match, - the original string is used and then the first match - again. Will also start 'wildmenu' if it is enabled. - "longest" Complete till longest common string. If this doesn't - result in a longer string, use the next part. - "list" When more than one match, list all matches. - "lastused" When completing buffer names and more than one buffer - matches, sort buffers by time last used (other than - the current buffer). - "noselect" Do not pre-select first menu item and start 'wildmenu' - if it is enabled. - When there is only a single match, it is fully completed in all cases - except when "noselect" is present. - - Examples of useful colon-separated values: - "longest:full" Like "longest", but also start 'wildmenu' if it is - enabled. Will not complete to the next full match. - "list:full" When more than one match, list all matches and - complete first match. - "list:longest" When more than one match, list all matches and - complete till longest common string. - "list:lastused" When more than one buffer matches, list all matches - and sort buffers by time last used (other than the - current buffer). + Completion mode used for the character specified with 'wildchar'. + This option is a comma-separated list of up to four parts, + corresponding to the first, second, third, and fourth presses of + 'wildchar'. Each part is a colon-separated list of completion + behaviors, which are applied simultaneously during that phase. + + The possible behavior values are: + "" Only complete (insert) the first match. No further + matches are cycled or listed. + "full" Complete the next full match. Cycles through all + matches, returning to the original input after the + last match. If 'wildmenu' is enabled, it will be + shown. + "longest" Complete to the longest common substring. If this + doesn't extend the input, the next 'wildmode' part is + used. + "list" If multiple matches are found, list all of them. + "lastused" When completing buffer names, sort them by most + recently used (excluding the current buffer). Only + applies to buffer name completion. + "noselect" If 'wildmenu' is enabled, show the menu but do not + preselect the first item. + If only one match exists, it is completed fully, unless "noselect" is + specified. + + Some useful combinations of colon-separated values: + "longest:full" Start with the longest common string and show + 'wildmenu' (if enabled). Does not cycle + through full matches. + "list:full" List all matches and complete first match. + "list:longest" List all matches and complete till the longest + common prefix. + "list:lastused" List all matches. When completing buffers, + sort them by most recently used (excluding the + current buffer). + "noselect:lastused" Do not preselect the first item in 'wildmenu' + if it is active. When completing buffers, + sort them by most recently used (excluding the + current buffer). Examples: > :set wildmode=full -< Complete first full match, next match, etc. (the default) > +< Complete full match on every press (default behavior) > :set wildmode=longest,full -< Complete longest common string, then each full match > +< First press: longest common substring + Second press: cycle through full matches > :set wildmode=list:full -< List all matches and complete each full match > +< First press: list all matches and complete the first one > :set wildmode=list,full -< List all matches without completing, then each full match > +< First press: list matches only + Second press: complete full matches > :set wildmode=longest,list -< Complete longest common string, then list alternatives > +< First press: longest common substring + Second press: list all matches > :set wildmode=noselect:full -< Display 'wildmenu' without completing, then each full match > +< First press: show 'wildmenu' without completing or selecting + Second press: cycle full matches > :set wildmode=noselect:lastused,full -< Same as above, but sort buffers by time last used. +< Same as above, but buffer matches are sorted by time last used More info here: |cmdline-completion|. *'wildoptions'* *'wop'*