Implement enabled=false configuration

This commit is contained in:
hrsh7th
2021-09-13 00:59:48 +09:00
parent 1cec1ecb31
commit a78894a09a
9 changed files with 69 additions and 48 deletions

View File

@@ -1,18 +0,0 @@
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