Files
my_nvim_config/lua/keybindings.lua
T
2026-07-14 14:00:09 +01:00

23 lines
603 B
Lua

---@class Keymap
---@field [1] string LHS key sequence
---@field [2] string|function RHS command or callback
---@field desc? string Description of the keymap
---@field mode? string|string[] Mode for the keymap
---@type Keymap[]
local keys = require("config.keys").globals
for _, map in ipairs(keys) do
local opts = {
noremap = true,
silent = true,
desc = map.desc,
}
for k, v in pairs(map) do
if k ~= 1 and k ~= 2 and k ~= "desc" and k ~= "mode" then
opts[k] = v
end
end
vim.keymap.set(map.mode or "n", map[1], map[2], opts)
end