From cb36ccfa8db66db953795fd8e22138ed1712b1cd Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Wed, 18 Sep 2024 00:58:26 +0200 Subject: checkpoint - added basic luasnip configuration - added highlights for TODO and FIXME keywords - added incremental selection of treesitter - added prettier to conform formatters - added when_disabled function to disable pairs in comments - changed the hiding keybind to :Hide command - only enable ` pairs in markdown - removed keybind - removed cmp's calc source - renamed keybinds for consistency - reorganized plugins in lazy.lua --- after/plugin/autoclose.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'after/plugin/autoclose.lua') 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" } }, -- cgit v1.2.3