From fcfc87cb7727eb63265dc75476dc6ba56e0029c8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 22 Sep 2023 06:51:47 +0800 Subject: 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(). --- runtime/doc/insert.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 0fa5ffd598..ce2ec36ca3 100644 --- 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("") vim.api.nvim_feedkeys(key, "m", false) end -- cgit