diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2025-09-09 11:35:41 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-09 03:35:41 +0000 |
| commit | eb19206e032a9798e68de1d76f02e568d8e076f4 (patch) | |
| tree | df74da59c932bbc3418a89768712a65df977d925 /runtime/lua/vim/_meta/options.lua | |
| parent | c553008e74e5521f190ffc41db981d5649910536 (diff) | |
vim-patch:9.1.1742: complete: preinsert does not work well with 'autocomplete' (#35692)
Problem: complete: preinsert does not work well with preinsert
Solution: Make "preinsert" completeopt value work with autocompletion
(Girish Palya)
This change extends Insert mode autocompletion so that 'preinsert' also
works when 'autocomplete' is enabled.
Try: `:set ac cot=preinsert`
See `:help 'cot'` for more details.
closes: vim/vim#18213
https://github.com/vim/vim/commit/fa6fd41a943e6442c1a2ce6b0a237298b00ecca0
Co-authored-by: Girish Palya <girishji@gmail.com>
Diffstat (limited to 'runtime/lua/vim/_meta/options.lua')
| -rw-r--r-- | runtime/lua/vim/_meta/options.lua | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index d517d6dca0..a545b75c26 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -1044,10 +1044,11 @@ vim.o.cms = vim.o.commentstring vim.bo.commentstring = vim.o.commentstring vim.bo.cms = vim.bo.commentstring ---- This option specifies how keyword completion `ins-completion` works ---- when CTRL-P or CTRL-N are used. It is also used for whole-line ---- completion `i_CTRL-X_CTRL-L`. It indicates the type of completion ---- and the places to scan. It is a comma-separated list of flags: +--- This option controls how completion `ins-completion` behaves when +--- using CTRL-P, CTRL-N, or `ins-autocompletion`. It is also used for +--- whole-line completion `i_CTRL-X_CTRL-L`. It indicates the type of +--- completion and the places to scan. It is a comma-separated list of +--- flags: --- . scan the current buffer ('wrapscan' is ignored) --- w scan buffers from other windows --- b scan other loaded buffers that are in the buffer list @@ -1095,9 +1096,11 @@ vim.bo.cms = vim.bo.commentstring --- (gzipped files for example). Unloaded buffers are not scanned for --- whole-line completion. --- ---- As you can see, CTRL-N and CTRL-P can be used to do any 'iskeyword'- ---- 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). +--- CTRL-N, CTRL-P, and `ins-autocompletion` can be used for any +--- 'iskeyword'-based completion (dictionary `i_CTRL-X_CTRL-K`, included +--- patterns `i_CTRL-X_CTRL-I`, tags `i_CTRL-X_CTRL-]`, and normal +--- expansions). With the "F" and "o" flags in 'complete', non-keywords +--- can also be completed. --- --- An optional match limit can be specified for a completion source by --- appending a caret ("^") followed by a {count} to the source flag. @@ -1215,17 +1218,22 @@ vim.go.cia = vim.go.completeitemalign --- with "menu" or "menuone". Overrides "preview". --- --- preinsert ---- Preinsert the portion of the first candidate word that is ---- not part of the current completion leader and using the ---- `hl-ComplMatchIns` highlight group. In order for it to ---- work, "fuzzy" must not be set and "menuone" must be set. +--- When autocompletion is not enabled, inserts the part of the +--- first candidate word beyond the current completion leader, +--- highlighted with `hl-ComplMatchIns`. The cursor does not +--- move. Requires "fuzzy" unset and "menuone" in 'completeopt'. +--- +--- When 'autocomplete' is enabled, inserts the longest common +--- prefix of matches (from all shown items or buffer-specific +--- matches), highlighted with `hl-PreInsert`. This occurs only +--- when no menu item is selected. Press CTRL-Y to accept. --- --- preview Show extra information about the currently selected --- completion in the preview window. Only works in --- combination with "menu" or "menuone". --- ---- Only "fuzzy", "popup" and "preview" have an effect when 'autocomplete' ---- is enabled. +--- Only "fuzzy", "popup", "preinsert" and "preview" have an effect when +--- 'autocomplete' is enabled. --- --- This option does not apply to `cmdline-completion`. See 'wildoptions' --- for that. |
