diff options
Diffstat (limited to 'pairs.lua')
-rw-r--r-- | pairs.lua | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -9,10 +9,10 @@ local l = require("lpeg") local M local builtin_textobjects = { - ["["] = { "[" , "]", name = "[] block" }, - ["{"] = { "{" , "}", name = "{} block" }, - ["<"] = { "<" , ">", name = "<> block" }, - ["("] = { "(" , ")", name = "() block" }, + ["["] = { "[" , "]" }, + ["{"] = { "{" , "}" }, + ["<"] = { "<" , ">" }, + ["("] = { "(" , ")" }, ['"'] = { '"' , '"', name = "A quoted string" }, ["'"] = { "'" , "'", name = "A single quoted string" }, ["`"] = { "`" , "`", name = "A backtick delimited string" }, @@ -313,7 +313,9 @@ local function new(execute, register, prefix, handler, help) table.insert(mappings, win_map(execute == vis.textobject, prefix, binding, help)) local builtin = execute == vis.motion and builtin_motions[prefix] or builtin_textobjects for key, _ in pairs(builtin) do - local hlp = (execute == vis.motion and help or "") .. (builtin_textobjects[key].name or "") + local d = builtin_textobjects[key] + local simple = type(d[1]) == "string" and type(d[2]) == "string" and d[1]..d[2] + local hlp = (execute == vis.motion and help or "") .. (d.name or (simple or "pattern-delimited") .." block") if execute ~= vis.textobject then vis:map(vis.modes.NORMAL, prefix..key, bind_builtin(key, execute, id), hlp) end |