Merge pull request #33667 from glepnir/vim-9.1.1341

vim-patch: 9.1.{1341,1344}
This commit is contained in:
zeertzjq
2025-04-29 14:59:32 +08:00
committed by GitHub
16 changed files with 427 additions and 1 deletions

View File

@@ -3438,6 +3438,31 @@ 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`.
---
--- Examples:
---
--- ```vim
--- set isexpand=.,->,/*,\\,
--- ```
---
---
--- @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`.

View File

@@ -1109,6 +1109,53 @@ function vim.fn.complete_check() end
--- @return table
function vim.fn.complete_info(what) end
--- Searches backward from the given position and returns a List
--- of matches according to the 'isexpand' option. When no
--- arguments are provided, uses the current cursor position.
---
--- Each match is represented as a List containing
--- [startcol, trigger_text] where:
--- - startcol: column position where completion should start,
--- or -1 if no trigger position is found. For multi-character
--- triggers, returns the column of the first character.
--- - trigger_text: the matching trigger string from 'isexpand',
--- or empty string if no match was found or when using the
--- default 'iskeyword' pattern.
---
--- When 'isexpand' is empty, uses the 'iskeyword' pattern
--- "\k\+$" to find the start of the current keyword.
---
--- Examples: >vim
--- set isexpand=.,->,/,/*,abc
--- func CustomComplete()
--- let res = complete_match()
--- if res->len() == 0 | return | endif
--- let [col, trigger] = res[0]
--- let items = []
--- if trigger == '/*'
--- let items = ['/** */']
--- elseif trigger == '/'
--- let items = ['/*! */', '// TODO:', '// fixme:']
--- elseif trigger == '.'
--- let items = ['length()']
--- elseif trigger =~ '^\->'
--- let items = ['map()', 'reduce()']
--- elseif trigger =~ '^\abc'
--- let items = ['def', 'ghk']
--- endif
--- if items->len() > 0
--- let startcol = trigger =~ '^/' ? col : col + len(trigger)
--- call complete(startcol, items)
--- endif
--- endfunc
--- inoremap <Tab> <Cmd>call CustomComplete()<CR>
--- <
---
--- @param lnum? integer
--- @param col? integer
--- @return table
function vim.fn.complete_match(lnum, col) end
--- confirm() offers the user a dialog, from which a choice can be
--- made. It returns the number of the choice. For the first
--- choice this is 1.