implement function to collect keystrokes
Try loading the plugin into nvim / build (ubuntu-20.04) (push) Successful in 15s
Details
Try loading the plugin into nvim / build (ubuntu-20.04) (push) Successful in 15s
Details
This commit is contained in:
parent
b6864110dc
commit
f017666011
|
@ -1,7 +1,7 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
local api = vim.api
|
local api = vim.api
|
||||||
|
|
||||||
local
|
local keystrokes = {}
|
||||||
|
|
||||||
-- Only for debugging
|
-- Only for debugging
|
||||||
if vim == nil then
|
if vim == nil then
|
||||||
|
@ -9,5 +9,21 @@ if vim == nil then
|
||||||
end
|
end
|
||||||
|
|
||||||
function Macrochain()
|
function Macrochain()
|
||||||
vim.print("Hello World!")
|
vim.print(table.concat(keystrokes, ""))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- @name record_keystroke
|
||||||
|
-- @param mapped_key
|
||||||
|
-- @param raw_key
|
||||||
|
-- @short Add mapped_key to keystrokes
|
||||||
|
local function record_keystroke(mapped_key, raw_key)
|
||||||
|
table.insert(keystrokes, mapped_key)
|
||||||
|
if #keystrokes > 60 then
|
||||||
|
local temp_keystrokes = {}
|
||||||
|
for i = 31, #keystrokes do
|
||||||
|
table.insert(temp_keystrokes, keystrokes[i])
|
||||||
|
end
|
||||||
|
keystrokes = temp_keystrokes
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.on_key(record_keystroke)
|
||||||
|
|
Loading…
Reference in New Issue