mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 11:25:33 +00:00
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().
This commit is contained in:
@@ -1093,11 +1093,11 @@ To get basic "autocompletion" without installing a plugin, try this script: >lua
|
|||||||
vim.api.nvim_create_autocmd("InsertCharPre", {
|
vim.api.nvim_create_autocmd("InsertCharPre", {
|
||||||
buffer = vim.api.nvim_get_current_buf(),
|
buffer = vim.api.nvim_get_current_buf(),
|
||||||
callback = function()
|
callback = function()
|
||||||
if vim.fn.pumvisible() == 1 then
|
if vim.fn.pumvisible() == 1 or vim.fn.state("m") == "m" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local char = vim.v.char
|
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>")
|
local key = vim.keycode("<C-x><C-n>")
|
||||||
vim.api.nvim_feedkeys(key, "m", false)
|
vim.api.nvim_feedkeys(key, "m", false)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user