local M = {} M.map = function(mode, lhs, rhs, desc, opts) local options = { noremap = true, silent = true, desc = desc } if opts then options = vim.tbl_extend("force", options, opts) end vim.keymap.set(mode, lhs, rhs, options) end M.lsp_map = function(lhs, rhs, bufnr, desc) vim.keymap.set("n", lhs, rhs, { silent = true, buffer = bufnr, desc = desc }) end M.set_leader = function(key) vim.g.mapleader = key vim.g.maplocalleader = key M.map({ "n", "v" }, key, "") end return M