diff options
author | Georgi Kirilov <> | 2021-05-04 12:51:41 +0300 |
---|---|---|
committer | Georgi Kirilov <> | 2023-10-04 18:24:59 +0800 |
commit | 7881ab94a3bae739c487f98e4ed5b195e3f3f786 (patch) | |
tree | 04c2711e16b72435f42ac535855b5fdd51ecb0b8 | |
parent | 4582e61b14cf52530aba7bcf777426458d42ce51 (diff) | |
download | vis-pairs-7881ab94a3bae739c487f98e4ed5b195e3f3f786.tar.gz |
tag help entries with |@plugin-name|
-rw-r--r-- | init.lua | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -6,6 +6,8 @@ local vis = vis local l = require("lpeg") +local progname = ... + -- XXX: in Lua 5.2 unpack() was moved into table local unpack = table.unpack or unpack @@ -288,6 +290,10 @@ local function prep(func) end end +local function h(msg) + return string.format("|@%s| %s", progname, msg) +end + local mappings = {} local function new(execute, register, prefix, handler, help) @@ -311,11 +317,11 @@ local function new(execute, register, prefix, handler, help) 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) + vis:map(vis.modes.NORMAL, prefix..key, bind_builtin(key, execute, id), h(hlp)) end local variant = prefix == M.prefix.outer and " (outer variant)" or prefix == M.prefix.inner and " (inner variant)" or "" - vis:map(vis.modes.VISUAL, prefix..key, bind_builtin(key, execute, id), hlp and hlp .. variant or help) - vis:map(vis.modes.OPERATOR_PENDING, prefix..key, bind_builtin(key, execute, id), hlp and hlp .. variant or help) + vis:map(vis.modes.VISUAL, prefix..key, bind_builtin(key, execute, id), h(hlp and hlp .. variant or help)) + vis:map(vis.modes.OPERATOR_PENDING, prefix..key, bind_builtin(key, execute, id), h(hlp and hlp .. variant or help)) end end return id |