diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-09-22 06:51:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-22 06:51:47 +0800 |
commit | fcfc87cb7727eb63265dc75476dc6ba56e0029c8 (patch) | |
tree | 371b7e1a494640ff3077e83699d930fdad7d5de7 | |
parent | 6555176f34f102a8878a0bac55fd80459c943aa2 (diff) | |
download | rneovim-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.txt | 4 |
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 |