|
1 | | -*insert.txt* For Vim version 9.1. Last change: 2025 Aug 25 |
| 1 | +*insert.txt* For Vim version 9.1. Last change: 2025 Sep 16 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -1150,7 +1150,26 @@ any of them at any time by typing |CTRL-X|, which temporarily suspends |
1150 | 1150 | autocompletion. To use |i_CTRL-N| or |i_CTRL-X_CTRL-N| specifically, press |
1151 | 1151 | |CTRL-E| first to dismiss the popup menu (see |complete_CTRL-E|). |
1152 | 1152 |
|
1153 | | -See also 'autocomplete', 'autocompletetimeout' and 'autocompletedelay'. |
| 1153 | + *ins-autocompletion-example* |
| 1154 | +Example setup ~ |
| 1155 | +A typical configuration for automatic completion with a popup menu: > |
| 1156 | + set autocomplete |
| 1157 | + set complete=.^5,w^5,b^5,u^5 |
| 1158 | + set completeopt=popup |
| 1159 | +
|
| 1160 | + inoremap <silent><expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" |
| 1161 | + inoremap <silent><expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" |
| 1162 | +< |
| 1163 | +This enables automatic completion with suggestions from the current buffer, |
| 1164 | +other windows, and listed buffers, displayed in a popup menu. Each source is |
| 1165 | +limited to 5 candidates. <Tab> and <S-Tab> move through the items when the |
| 1166 | +menu is visible. Optionally, add "preinsert" to 'completeopt' to insert the |
| 1167 | +longest common prefix automatically. Additional sources (e.g., LSP clients) |
| 1168 | +may be added to 'complete' to improve completion as required. |
| 1169 | + |
| 1170 | +See also 'autocomplete', 'autocompletedelay' and 'autocompletetimeout'. |
| 1171 | + |
| 1172 | +For command-line autocompletion, see |cmdline-autocompletion|. |
1154 | 1173 |
|
1155 | 1174 |
|
1156 | 1175 | FUNCTIONS FOR FINDING COMPLETIONS *complete-functions* |
@@ -1418,13 +1437,17 @@ In the first state these keys have a special meaning: |
1418 | 1437 | <BS> and CTRL-H Delete one character, find the matches for the word before |
1419 | 1438 | the cursor. This reduces the list of matches, often to one |
1420 | 1439 | entry, and switches to the second state. |
| 1440 | + When 'autocomplete' is active, clears the selected item in |
| 1441 | + the menu. |
1421 | 1442 | Any non-special character: |
1422 | 1443 | Stop completion without changing the match and insert the |
1423 | 1444 | typed character. |
1424 | 1445 |
|
1425 | 1446 | In the second and third state these keys have a special meaning: |
1426 | 1447 | <BS> and CTRL-H Delete one character, find the matches for the shorter word |
1427 | 1448 | before the cursor. This may find more matches. |
| 1449 | + When 'autocomplete' is active, clears the selected item in |
| 1450 | + the menu. |
1428 | 1451 | CTRL-L Add one character from the current match, may reduce the |
1429 | 1452 | number of matches. |
1430 | 1453 | any printable, non-white character: |
|
0 commit comments