feat: add option to disable when recording or executing a macro

This commit is contained in:
zeertzjq 2021-10-14 13:10:33 +08:00 committed by windwp
parent 8220306d01
commit 86dce0d460
2 changed files with 5 additions and 0 deletions

View File

@ -15,6 +15,7 @@ require('nvim-autopairs').setup{}
``` lua
local disable_filetype = { "TelescopePrompt" }
local disable_in_macro = false -- disable when recording or executing a macro
local ignored_next_char = string.gsub([[ [%w%%%'%[%"%.] ]],"%s+", "")
local enable_moveright = true
local enable_afterquote = true -- add bracket pairs after quote

View File

@ -15,6 +15,7 @@ local default = {
map_bs = true,
map_c_w = false,
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
disable_in_macro = false,
ignored_next_char = string.gsub([[ [%w%%%'%[%"%.] ]], '%s+', ''),
check_ts = false,
enable_moveright = true,
@ -133,6 +134,9 @@ local function is_disable()
if vim.bo.modifiable == false then
return true
end
if M.config.disable_in_macro and (vim.fn.reg_recording() ~= '' or vim.fn.reg_executing() ~= '') then
return true
end
if utils.check_filetype(M.config.disable_filetype, vim.bo.filetype) then
-- should have a way to remove the mapping when vim.bo.filetype = ''