feat: Use vim.keymap.set for setting keymaps

This commit is contained in:
Simrat Grewal
2022-08-10 15:08:46 -07:00
parent d12af70950
commit 374b80010a
2 changed files with 17 additions and 12 deletions

View File

@@ -2,14 +2,15 @@ local M = {}
---maps the table|string of keys to the action
---@param keys table|string
---@param action string
---@param action function|string
function M.nmap(bufnr, keys, action)
if type(keys) == 'string' then
keys = { keys }
end
for _, value in ipairs(keys) do
vim.api.nvim_buf_set_keymap(bufnr, 'n', value, action, { silent = true, noremap = true })
for _, lhs in ipairs(keys) do
vim.keymap.set('n', lhs, action, { silent = true, noremap = true, buffer = bufnr })
end
end