mirror of
https://github.com/vim/vim.git
synced 2025-11-15 23:14:06 -05:00
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:
committed by
Christian Brabandt
parent
3fc1f2a00e
commit
c05335082a
11
src/edit.c
11
src/edit.c
@@ -693,11 +693,12 @@ edit(
|
||||
&& stop_arrow() == OK)
|
||||
{
|
||||
ins_compl_delete();
|
||||
if (ins_compl_has_preinsert()
|
||||
&& ins_compl_autocomplete_enabled())
|
||||
(void)ins_compl_insert(FALSE, TRUE);
|
||||
else
|
||||
(void)ins_compl_insert(FALSE, FALSE);
|
||||
ins_compl_insert(FALSE, !ins_compl_has_preinsert());
|
||||
if (ins_compl_preinsert_longest())
|
||||
{
|
||||
ins_compl_init_get_longest();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Delete preinserted text when typing special chars
|
||||
else if (IS_WHITE_NL_OR_NUL(c) && ins_compl_preinsert_effect())
|
||||
|
||||
Reference in New Issue
Block a user