-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Hi,
I do not know if this is the right place to ask, but I am in need of a small plugin to insert a string and place the cursor at a certain place, to help with improving my Hugo workflow.
Problem is I don't know anything about Lua and frankly I can't go into it, even if I wanted.
I'd like to associate, say alt+a to pasting
{{<keys "" >}}
and having the cursor placed between the quotation marks.
AI produced this slop:
local micro = import("micro")
local config = import("micro/config")
function insertKeys(bp)
local cursor = bp:Cursor()
local line = cursor.Loc.Y
local col = cursor.Loc.X
local textToInsert = '{{<keys "" >}}'
bp.Buf:Insert(textToInsert, line, col)
cursor:SetLoc(col + #textToInsert - 3, line)
end
function init()
config.MakeCommand("insertkeys", insertKeys, config.NoComplete)
-- config.TryBindKey("Alt-o", "lua:insertkeys", false)
end
But it's obviously BS, causing the error
Lua API error: keysplugin:5: attempt to call a non-function object
stack traceback:
keysplugin:5: in main chunk
[G]: ?
It shouldn't be complicated, I'd be very grateful if you helped me.
Metadata
Metadata
Assignees
Labels
No labels