diff options
Diffstat (limited to 'after/plugin/autoclose.lua')
-rw-r--r-- | after/plugin/autoclose.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/after/plugin/autoclose.lua b/after/plugin/autoclose.lua index b742fc6..1c912da 100644 --- a/after/plugin/autoclose.lua +++ b/after/plugin/autoclose.lua @@ -1,3 +1,14 @@ +local function in_comment() + if + require("cmp.config.context").in_treesitter_capture("comment") == true + or require("cmp.config.context").in_syntax_group("Comment") + then + return true + else + return false + end +end + local filetypes = require("autoclose").setup({ keys = { ["("] = { escape = false, close = true, pair = "()" }, @@ -18,12 +29,13 @@ local filetypes = require("autoclose").setup({ close = true, pair = "''", disabled_filetypes = { "text", "telekasten", "groff", "diff", "gitcommit", "fugitive", "markdown" }, + disabled_when = in_comment, }, ["`"] = { escape = true, close = true, pair = "``", - disabled_filetypes = { "text", "telekasten", "groff", "diff", "gitcommit", "fugitive" }, + enabled_fileptypes = { "markdown" }, }, ["*"] = { escape = true, close = true, pair = "**", enabled_filetypes = { "markdown" } }, ["_"] = { escape = true, close = true, pair = "__", enabled_filetypes = { "markdown" } }, |