Replace exclude_filetypes by not_filetypes

This commit is contained in:
TANIGUCHI Masaya 2021-08-07 03:43:27 +00:00 committed by windwp
parent 14bad1f3cd
commit 50fec950de
3 changed files with 5 additions and 6 deletions

View File

@ -194,7 +194,7 @@ npairs.add_rules({
-- you can exclude filetypes
npairs.add_rule(
Rule("$$","$$")
:with_pair(cond.exclude_filetypes({"lua"}))
:with_pair(cond.not_filetypes({"lua"}))
)
--- check ./lua/nvim-autopairs/rules/basic.lua

View File

@ -198,15 +198,14 @@ cond.is_end_line = function()
end
end
cond.exclude_filetypes = function(filetypes)
cond.not_filetypes = function(filetypes)
return function(opts)
log.debug('exclude_filetypes')
log.debug('not_filetypes')
for _, filetype in pairs(filetypes) do
if vim.bo.filetype == filetype then
return false
end
end
return true
end
end

View File

@ -380,7 +380,7 @@ local data = {
},
{
setup_func = function()
npairs.add_rule(Rule("!", "!"):with_pair(cond.exclude_filetypes({"lua"})))
npairs.add_rule(Rule("!", "!"):with_pair(cond.not_filetypes({"lua"})))
end,
name="disable pairs in lua",
filetype="lua",
@ -390,7 +390,7 @@ local data = {
},
{
setup_func = function()
npairs.add_rule(Rule("!", "!"):with_pair(cond.exclude_filetypes({"lua"})))
npairs.add_rule(Rule("!", "!"):with_pair(cond.not_filetypes({"lua"})))
end,
name="enable pairs in html",
filetype="html",