From 50fec950de31edc84bb7799b6a692a187037c03b Mon Sep 17 00:00:00 2001 From: TANIGUCHI Masaya Date: Sat, 7 Aug 2021 03:43:27 +0000 Subject: [PATCH] Replace exclude_filetypes by not_filetypes --- README.md | 2 +- lua/nvim-autopairs/conds.lua | 5 ++--- tests/nvim-autopairs_spec.lua | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cbab5f9..e710d8d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lua/nvim-autopairs/conds.lua b/lua/nvim-autopairs/conds.lua index d723454..b685747 100644 --- a/lua/nvim-autopairs/conds.lua +++ b/lua/nvim-autopairs/conds.lua @@ -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 diff --git a/tests/nvim-autopairs_spec.lua b/tests/nvim-autopairs_spec.lua index 2c95eb2..7bba1e1 100644 --- a/tests/nvim-autopairs_spec.lua +++ b/tests/nvim-autopairs_spec.lua @@ -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",