[Geany] GeanyLua plug-in "prefix" key?
Jeff Pohlmeyer
yetanothergeek at xxxxx
Mon Jan 28 16:18:21 UTC 2008
I just uploaded geanylua-0.6.1, which adds an _optional_
"prompt" argument to the keygrab() function.
Try the script below to see the added coolness...
--------------------------
geany.timeout(60)
local keytable = {
l="examples/edit/lua-replace.lua",
p="examples/edit/proper-case.lua",
r="examples/edit/reverse.lua",
t="examples/edit/right-trim.lua",
b="examples/edit/select-block.lua"
}
local prompt = { "\n Press a key...\n" }
for k,v in pairs(keytable) do
table.insert(prompt, " " .. k..': '..
geany.basename(v):gsub("%.lua$", "").." ")
end
table.insert(prompt, "\n [Esc] to cancel.\n")
local key = geany.keygrab(table.concat(prompt, "\n"))
if key and (key ~="Escape") then
local filename = keytable[key]
if filename then
dofile(geany.appinfo().scriptdir.."/"..filename)
else
geany.message("Key value '"..key.."' not assigned.")
end
end
--------------------------
- Jeff
More information about the Users
mailing list