aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-09-22 06:51:47 +0800
committerGitHub <noreply@github.com>2023-09-22 06:51:47 +0800
commitfcfc87cb7727eb63265dc75476dc6ba56e0029c8 (patch)
tree371b7e1a494640ff3077e83699d930fdad7d5de7
parent6555176f34f102a8878a0bac55fd80459c943aa2 (diff)
downloadrneovim-fcfc87cb7727eb63265dc75476dc6ba56e0029c8.tar.gz
rneovim-fcfc87cb7727eb63265dc75476dc6ba56e0029c8.tar.bz2
rneovim-fcfc87cb7727eb63265dc75476dc6ba56e0029c8.zip
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().
-rw-r--r--runtime/doc/insert.txt4
1 files changed, 2 insertions, 2 deletions
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("<C-x><C-n>")
vim.api.nvim_feedkeys(key, "m", false)
end