mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 17:06:30 +00:00
vim-patch:9.1.1341: cannot define completion triggers
Problem: Cannot define completion triggers and act upon it
Solution: add the new option 'isexpand' and add the complete_match()
function to return the completion matches according to the
'isexpand' setting (glepnir)
Currently, completion trigger position is determined solely by the
'iskeyword' pattern (\k\+$), which causes issues when users need
different completion behaviors - such as triggering after '/' for
comments or '.' for methods. Modifying 'iskeyword' to include these
characters has undesirable side effects on other Vim functionality that
relies on keyword definitions.
Introduce a new buffer-local option 'isexpand' that allows specifying
different completion triggers and add the complete_match() function that
finds the appropriate start column for completion based on these
triggers, scanning backwards from cursor position.
This separation of concerns allows customized completion behavior
without affecting iskeyword-dependent features. The option's
buffer-local nature enables per-filetype completion triggers.
closes: vim/vim#16716
bcd5995b40
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@@ -4628,6 +4628,29 @@ local options = {
|
||||
type = 'boolean',
|
||||
immutable = true,
|
||||
},
|
||||
{
|
||||
abbreviation = 'ise',
|
||||
cb = 'did_set_isexpand',
|
||||
defaults = '',
|
||||
deny_duplicates = false,
|
||||
desc = [=[
|
||||
Defines characters and patterns for completion in insert mode. Used by
|
||||
the |complete_match()| function to determine the starting position for
|
||||
completion. This is a comma-separated list of triggers. Each trigger
|
||||
can be:
|
||||
- A single character like "." or "/"
|
||||
- A sequence of characters like "->", "/*", or "/**"
|
||||
|
||||
Note: Use "\\," to add a literal comma as trigger character, see
|
||||
|option-backslash|.
|
||||
]=],
|
||||
full_name = 'isexpand',
|
||||
list = 'onecomma',
|
||||
scope = { 'global', 'buf' },
|
||||
short_desc = N_('Defines characters and patterns for completion in insert mode'),
|
||||
type = 'string',
|
||||
varname = 'p_ise',
|
||||
},
|
||||
{
|
||||
abbreviation = 'isf',
|
||||
cb = 'did_set_isopt',
|
||||
|
Reference in New Issue
Block a user