diff options
| author | glepnir <glephunter@gmail.com> | 2025-04-26 13:06:43 +0800 |
|---|---|---|
| committer | glepnir <glephunter@gmail.com> | 2025-04-27 15:00:31 +0800 |
| commit | fcabbc2283c5d217d879d4ac0cc6c8501f15fc64 (patch) | |
| tree | e7b0dede1eaefc147cb8087f36a9cc4ec27e1129 /runtime/lua/vim/_meta/options.lua | |
| parent | ac8ae1596cda8a96af0c26046463ba6327cfb0f8 (diff) | |
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
https://github.com/vim/vim/commit/bcd5995b40a1c26e735bc326feb2e3ac4b05426b
Co-authored-by: glepnir <glephunter@gmail.com>
Diffstat (limited to 'runtime/lua/vim/_meta/options.lua')
| -rw-r--r-- | runtime/lua/vim/_meta/options.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 1e0e40a3a3..13dec50231 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -3429,6 +3429,24 @@ vim.o.inf = vim.o.infercase vim.bo.infercase = vim.o.infercase vim.bo.inf = vim.bo.infercase +--- 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`. +--- +--- @type string +vim.o.isexpand = "" +vim.o.ise = vim.o.isexpand +vim.bo.isexpand = vim.o.isexpand +vim.bo.ise = vim.bo.isexpand +vim.go.isexpand = vim.o.isexpand +vim.go.ise = vim.go.isexpand + --- The characters specified by this option are included in file names and --- path names. Filenames are used for commands like "gf", "[i" and in --- the tags file. It is also used for "\f" in a `pattern`. |
