nvim: Improve mini.pairs triple mappings
Whenever there is a left-over quote (') or double quote ("), if we want
to 'close' it, mini.pairs will by default add a new pair (e.g. """)
instead. This simply changes it to close the pair. Makes some
'double-quote' pairings harder (e.g. we have a python dict: {"name"})
and want to add another {"name""value"} into it, but this happens
relatively rarely in my use cases. The first on the other hand happens
frequently enough to be an annoyance.
Additionally, did the same for back-ticks so we can more easily create
triple backticks ``` which are essential in many literate programming
markup languages (markdown, quarto, rmd and so on).
This commit is contained in:
parent
b5198c385c
commit
35d1f8b03d
1 changed files with 27 additions and 1 deletions
|
|
@ -250,7 +250,33 @@ return {
|
||||||
require("mini.map").setup()
|
require("mini.map").setup()
|
||||||
require("mini.move").setup()
|
require("mini.move").setup()
|
||||||
require("mini.operators").setup()
|
require("mini.operators").setup()
|
||||||
require("mini.pairs").setup()
|
require("mini.pairs").setup({
|
||||||
|
mappings = {
|
||||||
|
-- these mappings ensure that when trying to _close_ any of the pairs
|
||||||
|
-- it will not double insert:
|
||||||
|
-- " <- you are here. Normal pairs will do """. This config will do "".
|
||||||
|
['"'] = {
|
||||||
|
action = "closeopen",
|
||||||
|
pair = '""',
|
||||||
|
neigh_pattern = '[^\\"].',
|
||||||
|
register = { cr = false },
|
||||||
|
},
|
||||||
|
["'"] = {
|
||||||
|
action = "closeopen",
|
||||||
|
pair = "''",
|
||||||
|
neigh_pattern = "[^%a\\'].",
|
||||||
|
register = { cr = false },
|
||||||
|
},
|
||||||
|
["`"] = {
|
||||||
|
action = "closeopen",
|
||||||
|
pair = "``",
|
||||||
|
neigh_pattern = "[^\\`].",
|
||||||
|
register = { cr = false },
|
||||||
|
},
|
||||||
|
["<"] = { action = "open", pair = "<>", neigh_pattern = "\r." },
|
||||||
|
[">"] = { action = "close", pair = "<>" },
|
||||||
|
},
|
||||||
|
})
|
||||||
require("mini.trailspace").setup()
|
require("mini.trailspace").setup()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue