summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorgi Kirilov <>2021-05-04 12:51:41 +0300
committerGeorgi Kirilov <>2023-10-04 18:24:59 +0800
commit7881ab94a3bae739c487f98e4ed5b195e3f3f786 (patch)
tree04c2711e16b72435f42ac535855b5fdd51ecb0b8
parent4582e61b14cf52530aba7bcf777426458d42ce51 (diff)
downloadvis-pairs-7881ab94a3bae739c487f98e4ed5b195e3f3f786.tar.gz
tag help entries with |@plugin-name|
-rw-r--r--init.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index d312fbe..a986912 100644
--- a/init.lua
+++ b/init.lua
@@ -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