Skip to content
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
48 changes: 36 additions & 12 deletions doc/insert.jax
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*insert.txt* For Vim バージョン 9.1. Last change: 2025 Aug 25
*insert.txt* For Vim バージョン 9.1. Last change: 2025 Sep 16


VIMリファレンスマニュアル by Bram Moolenaar
Expand Down Expand Up @@ -1090,7 +1090,26 @@ Vim は、|i_CTRL-N| を使うのと同様に、入力中に自動的に補完
される。|i_CTRL-N| または |i_CTRL-X_CTRL-N| を使用するには、まず |CTRL-E| を押
してポップアップメニューを閉じる (|complete_CTRL-E| を参照)。

'autocomplete'、'autocompletetimeout' および 'autocompletedelay' も参照。
*ins-autocompletion-example*
設定例 ~
ポップアップメニューによる自動補完の一般的な構成: >
set autocomplete
set complete=.^5,w^5,b^5,u^5
set completeopt=popup

inoremap <silent><expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <silent><expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
<
これにより、現在のバッファ、他のウィンドウ、およびリストされたバッファからの候
補がポップアップメニューに表示される自動補完が可能になる。各ソースの候補は 5
つまでである。メニューが表示されている間は、<Tab> と <S-Tab> で項目間を移動で
きる。オプションで、'completeopt' に "preinsert" を追加すると、最長共通プリ
フィックスが自動的に挿入される。必要に応じて補完精度を向上させるために、追加の
ソース (例えば、LSP クライアント) を 'complete' に追加できる。

'autocomplete'、'autocompletedelay' および 'autocompletetimeout' も参照。

コマンドラインの自動補完については、|cmdline-autocompletion| を参照。


☆補完候補を検索する関数 *complete-functions*
Expand Down Expand Up @@ -1347,17 +1366,22 @@ CTRL-N や CTRL-P を押すことなどによって他の候補を選択する
<
*popupmenu-keys*
状態1では以下のキーは特別な意味を持つ:
<BS> と CTRL-H 1文字削除し、カーソル前の単語の候補を検索する。これによって候
補の数は少なくなり、しばしば1個だけになって状態2へ遷移する。
<BS> と CTRL-H 1文字削除し、カーソル前の単語の候補を検索する。これによって
候補の数は少なくなり、しばしば1個だけになって状態2へ遷移す
る。
'autocomplete' がアクティブな場合、メニュー内の選択された項
目をクリアする。
特殊文字でない任意の文字:
候補を変更せずに補完を停止し、入力された文字を挿入する。
候補を変更せずに補完を停止し、入力された文字を挿入する。

状態2と状態3では以下のキーは特別な意味を持つ:
<BS> と CTRL-H 1文字削除し、カーソル前の(短くなった)単語の候補を検索する。候
補の数は増える。
CTRL-L 現在の候補から1文字を挿入する。候補の数は少なくなる。
<BS> と CTRL-H 1文字削除し、カーソル前の(短くなった)単語の候補を検索する。候
補の数は増える。
'autocomplete' がアクティブな場合、メニュー内の選択された項
目をクリアする。
CTRL-L 現在の候補から1文字を挿入する。候補の数は少なくなる。
印字可能で空白文字でない任意の文字:
その文字を挿入する。候補の数は少なくなる。
その文字を挿入する。候補の数は少なくなる。

以上すべての状態で以下のキーが使える:
CTRL-Y Yes: 現在選択されている候補に決定し、補完を終了する。
Expand All @@ -1370,9 +1394,9 @@ CTRL-E 補完を終了し、候補を選択する前の状態(タイプした
<Space> or <Tab> 候補を変更せずに補完を終了し、タイプされた文字を挿入する。

<Enter>キーの挙動は状態に依存する:
状態1: テキストはそのままにし、改行を挿入する。
状態2: 選択されている候補を挿入する。
状態3: テキストはそのままにし、改行を挿入する。
状態1: テキストはそのままにし、改行を挿入する。
状態2: 選択されている候補を挿入する。
状態3: テキストはそのままにし、改行を挿入する。

言い換えると: カーソルキーでリストから他の候補を選択した後 <Enter> を押すとそ
の候補を挿入する。それ以外をタイプした後で <Enter> を押すと改行が挿入される。
Expand Down
27 changes: 25 additions & 2 deletions en/insert.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*insert.txt* For Vim version 9.1. Last change: 2025 Aug 25
*insert.txt* For Vim version 9.1. Last change: 2025 Sep 16


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -1150,7 +1150,26 @@ any of them at any time by typing |CTRL-X|, which temporarily suspends
autocompletion. To use |i_CTRL-N| or |i_CTRL-X_CTRL-N| specifically, press
|CTRL-E| first to dismiss the popup menu (see |complete_CTRL-E|).

See also 'autocomplete', 'autocompletetimeout' and 'autocompletedelay'.
*ins-autocompletion-example*
Example setup ~
A typical configuration for automatic completion with a popup menu: >
set autocomplete
set complete=.^5,w^5,b^5,u^5
set completeopt=popup

inoremap <silent><expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <silent><expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
<
This enables automatic completion with suggestions from the current buffer,
other windows, and listed buffers, displayed in a popup menu. Each source is
limited to 5 candidates. <Tab> and <S-Tab> move through the items when the
menu is visible. Optionally, add "preinsert" to 'completeopt' to insert the
longest common prefix automatically. Additional sources (e.g., LSP clients)
may be added to 'complete' to improve completion as required.

See also 'autocomplete', 'autocompletedelay' and 'autocompletetimeout'.

For command-line autocompletion, see |cmdline-autocompletion|.


FUNCTIONS FOR FINDING COMPLETIONS *complete-functions*
Expand Down Expand Up @@ -1418,13 +1437,17 @@ In the first state these keys have a special meaning:
<BS> and CTRL-H Delete one character, find the matches for the word before
the cursor. This reduces the list of matches, often to one
entry, and switches to the second state.
When 'autocomplete' is active, clears the selected item in
the menu.
Any non-special character:
Stop completion without changing the match and insert the
typed character.

In the second and third state these keys have a special meaning:
<BS> and CTRL-H Delete one character, find the matches for the shorter word
before the cursor. This may find more matches.
When 'autocomplete' is active, clears the selected item in
the menu.
CTRL-L Add one character from the current match, may reduce the
number of matches.
any printable, non-white character:
Expand Down