blob: 64b5609318b1d4e5b80ffe18d4594852499fc64b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
--[[ 50-autopairs.lua — autopairs rules for markdown.
Pairs `*` and `~` so that `**bold**` and `~~strike~~` auto-close, via nvim-autopairs.
]]
local Rule = require("nvim-autopairs.rule")
local npairs = require("nvim-autopairs")
local cond = require("nvim-autopairs.conds")
npairs.setup()
--[[ Auto-close `*` and `~` in markdown, but only when not already before the same char (so `**`/`~~`
nest cleanly), and never expand them on `<CR>`. ]]
npairs.add_rules({
Rule("*", "*", "markdown"):with_move(cond.not_before_regex("%*")):with_cr(cond.none()),
Rule("~", "~", "markdown"):with_move(cond.not_before_regex("~")):with_cr(cond.none()),
})
|