Skip to content

Instantly share code, notes, and snippets.

@cra
Created August 16, 2012 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cra/3369515 to your computer and use it in GitHub Desktop.
Save cra/3369515 to your computer and use it in GitHub Desktop.
-- cfg_sp.lua
counter = {}
function kpress_count(binding, fn, args)
if counter.binding then
counter.binding = counter.binding + 1
else
counter.binding = 1
end
fn(unpack(args))
print(binding .. "pressed" .. counter.binding .. " times.")
return kpress(binding, fn .. "(" .. upack(args) .. ")")
end
defbindings("WScreen", {
bdoc("Toggle scratchpad."),
kpress_count(ALTMETA.."Shift+C", "named_scratchpad", "{_, 'ims'}"),
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment