Files
nvim-cmp/lua/cmp/utils/check.lua
hrsh7th 22ec3ad442 Check buftype is prompt
Improve incomplete handling
2021-08-10 16:57:54 +09:00

19 lines
344 B
Lua

local check = {}
check.ok = function()
local ng = false
ng = ng or vim.api.nvim_buf_get_option(0, 'buftype') == 'prompt'
ng = ng or string.sub(vim.api.nvim_get_mode().mode, 1, 1) ~= 'i'
return not ng
end
check.wrap = function(callback)
return function(...)
if check.ok() then
callback(...)
end
end
end
return check