local insx = require("insx") local standard = require("insx.preset.standard") -- markdown `. insx.add("`", { enabled = function(ctx) return ctx.match([[`\%#`]]) and ctx.filetype == "markdown" end, action = function(ctx) ctx.send("``") ctx.send("``") end, }) insx.add( "", require("insx.recipe.fast_break")({ open_pat = [[```\w*]], close_pat = "```", indent = 0, }) ) -- html tag like. insx.add( "", require("insx.recipe.fast_break")({ open_pat = insx.helper.search.Tag.Open, close_pat = insx.helper.search.Tag.Close, }) ) -- quotes standard.set_quote("i", "`") standard.set_quote("i", '"', { { enabled = function(enabled, ctx) local disabled_filetypes = { sql = true, } return enabled(ctx) and disabled_filetypes[ctx.filetype] == nil end, }, }) standard.set_quote("i", "'", { { enabled = function(enabled, ctx) local disabled_filetypes = { rust = true, } return enabled(ctx) and disabled_filetypes[ctx.filetype] == nil end, }, }) for _, quote in ipairs({ '"', "'", "`" }) do standard.set_quote("c", quote) end -- pairs for open, close in pairs({ ["("] = ")", ["["] = "]", ["{"] = "}", }) do standard.set_pair("i", open, close) standard.set_pair("c", open, close) end