commit fcfc87cb7727eb63265dc75476dc6ba56e0029c8
parent 6555176f34f102a8878a0bac55fd80459c943aa2
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri, 22 Sep 2023 06:51:47 +0800
docs: small improvements to compl-autocomplete example (#25299)
- Don't complete when there is pending input.
- Use vim.list_contains() instead of vim.tbl_contains().
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
@@ -1093,11 +1093,11 @@ To get basic "autocompletion" without installing a plugin, try this script: >lua
vim.api.nvim_create_autocmd("InsertCharPre", {
buffer = vim.api.nvim_get_current_buf(),
callback = function()
- if vim.fn.pumvisible() == 1 then
+ if vim.fn.pumvisible() == 1 or vim.fn.state("m") == "m" then
return
end
local char = vim.v.char
- if vim.tbl_contains(triggers, char) then
+ if vim.list_contains(triggers, char) then
local key = vim.keycode("<C-x><C-n>")
vim.api.nvim_feedkeys(key, "m", false)
end