mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 00:08:19 +00:00
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
fa6fd41a94
Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
34
runtime/lua/vim/_meta/options.lua
generated
34
runtime/lua/vim/_meta/options.lua
generated
@@ -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.
|
||||
|
Reference in New Issue
Block a user