patch 9.1.1797: completion: autocompletion can be improved

Problem:  completion: autocompletion can be improved
Solution: Add support for "longest" and "preinsert" in 'autocomplete';
          add preinserted() (Girish Palya)

* Add support for "longest" in 'completeopt' when 'autocomplete'
  is enabled. (Note: the cursor position does not change automatically
  when 'autocomplete' is enabled.)
* Add support for "preinsert" when 'autocomplete' is enabled. Ensure
  "preinsert" works the same with and without 'autocomplete'
* introduce the preinserted() Vim script function, useful for defining
  custom key mappings.

fixes: #18314
closes: #18387

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-09-26 17:29:38 +00:00
committed by Christian Brabandt
parent 3fc1f2a00e
commit c05335082a
13 changed files with 336 additions and 114 deletions

View File

@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 9.1. Last change: 2025 Aug 23
*usr_41.txt* For Vim version 9.1. Last change: 2025 Sep 26
VIM USER MANUAL - by Bram Moolenaar
@ -1135,6 +1135,7 @@ Insert mode completion: *completion-functions*
complete_info() get current completion information
complete_match() get insert completion start match col and
trigger text
preinserted() check if text is inserted after cursor
pumvisible() check if the popup menu is displayed
pum_getpos() position and size of popup menu if visible