Skip to content

Conversation

@girishji
Copy link
Contributor

feat: support "longest" and "preinsert" in 'autocomplete'; add preinserted(), plus related fixes

  • Add support for "longest" in 'completeopt' when 'autocomplete' is enabled.
    (Note: the cursor position does not change automatically when 'autocomplete' is enabled.)
    Screenshot 2025-09-24 at 11 41 48 PM
  • Add support for "preinsert" when 'autocomplete' is enabled. Ensure "preinsert" works the same with and without 'autocomplete' .
    Fixes vim/vim#18314.
  • Introduced the preinserted() Vimscript function, useful for defining custom key mappings.

…n, and other improvements

* Add support for `longest` in `'completeopt'` when `'autocomplete'` is enabled
* Make `preinsert` during `'autocomplete'` behave the same as when `'autocomplete'` is disabled
* Add `preinserted()` Vimscript function
M  runtime/doc/options.txt
M  runtime/doc/options.txt
M  src/proto/insexpand.pro
girishji and others added 4 commits September 25, 2025 22:29
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
M  runtime/doc/usr_41.txt
@chrisbra
Copy link
Member

thanks

@girishji
Copy link
Contributor Author

Thanks.

@girishji girishji deleted the preinbugs branch September 27, 2025 10:36
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Sep 30, 2025
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: vim/vim#18314
closes: vim/vim#18387

vim/vim@c053350

Co-authored-by: Girish Palya <girishji@gmail.com>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Sep 30, 2025
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: vim/vim#18314
closes: vim/vim#18387

vim/vim@c053350

Co-authored-by: Girish Palya <girishji@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

preinsert with autocomplete only inserts the longest completion

3 participants