Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: testing and configurable iterative mapping #26

Merged
merged 17 commits into from
Dec 20, 2023
51 changes: 51 additions & 0 deletions lua/hawtkeys/tests/set_maps.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
vim.api.nvim_set_keymap(
"n",
"<leader>1",
':lua print("1 pressed")<CR>',
{ noremap = true, silent = true }
)
vim.keymap.set(
"n",
"<leader>2",
':lua print("2 pressed")<CR>',
{ noremap = true, silent = true }
)

local normalMap = function(lhs, rhs)
vim.api.nvim_set_keymap("n", lhs, rhs, { noremap = true, silent = true })
end
normalMap("<leader>3", ':lua print("3 pressed")<CR>')

local shortIndex = vim.api

shortIndex.nvim_set_keymap(
"n",
"<leader>4",
':lua print("4 pressed")<CR>',
{ noremap = true, silent = true }
)

local shortFunc = vim.api.nvim_set_keymap

shortFunc(
"n",
"<leader>5",
':lua print("5 pressed")<CR>',
{ noremap = true, silent = true }
)

local whichkey = require("which-key")

whichkey.register({
["<leader>"] = {
["6"] = { ':lua print("6 pressed")<CR>', "Print 6" },
["7"] = { ':lua print("7 pressed")<CR>', "Print 7" },
},
})

return {
"plugin/example",
keys = {
{ "<leader>8", ":lua print('8 pressed" },
},
}
5 changes: 5 additions & 0 deletions lua/hawtkeys/tests/test_ts.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
local ts = require("hawtkeys.ts")

local maps = ts.find_maps_in_file("lua/hawtkeys/tests/set_maps.lua")
print(vim.inspect(maps))
ts.reset_scanned_files()
Loading
Loading