|
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 11 |
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*
|
|
0 commit comments