diff options
author | Georgi Kirilov <> | 2020-11-22 15:10:49 +0200 |
---|---|---|
committer | Georgi Kirilov <> | 2023-10-04 18:24:58 +0800 |
commit | f284023a15d92a63c0e1c8a84b8de977313d3733 (patch) | |
tree | 5eead2471a3c96fd3312e40623d6da4d02d682eb /pairs.lua | |
parent | 8d0c543453b671086480ed106df1378cf49cc384 (diff) | |
download | vis-pairs-f284023a15d92a63c0e1c8a84b8de977313d3733.tar.gz |
Universal text object for quotes
Diffstat (limited to 'pairs.lua')
-rw-r--r-- | pairs.lua | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -189,8 +189,11 @@ vis.events.subscribe(vis.events.INIT, function() } local tag = {"<" * l.Cg(l.C((l.S"_:" + l.R("az", "AZ")) * (l.R("az", "AZ", "09") + l.S"_:.-")^0), "t") * (1 - l.S"><")^0 * (">" - l.B"/"), l.Cmt("</" * l.Cb("t") * l.C((1 - l.P">")^1) * ">", function(_, _, c1, c2) return c1 == c2 end)} - local any_bracket = {l.Cg(l.C(l.S"([{"), "s"), l.Cmt(l.Cb("s") * l.C(1), function(_, _, c1, c2) return builtin_textobjects[c1][2] == c2 end)} + local function any_pair(set) return {l.Cg(l.C(l.S(set)), "s"), l.Cmt(l.Cb("s") * l.C(1), function(_, _, c1, c2) return builtin_textobjects[c1][2] == c2 end)} end + local any_quote = any_pair("'`\"") + local any_bracket = any_pair("({[") local presets = { + {q = any_quote}, html = {t = tag}, xml = {t = tag}, scheme = {b = any_bracket}, |