summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/helpers/keys.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/helpers/keys.lua')
-rw-r--r--.config/nvim/lua/helpers/keys.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/.config/nvim/lua/helpers/keys.lua b/.config/nvim/lua/helpers/keys.lua
new file mode 100644
index 0000000..ebbcf6e
--- /dev/null
+++ b/.config/nvim/lua/helpers/keys.lua
@@ -0,0 +1,21 @@
1local M = {}
2
3M.map = function(mode, lhs, rhs, desc, opts)
4 local options = { noremap = true, silent = true, desc = desc }
5 if opts then
6 options = vim.tbl_extend("force", options, opts)
7 end
8 vim.keymap.set(mode, lhs, rhs, options)
9end
10
11M.lsp_map = function(lhs, rhs, bufnr, desc)
12 vim.keymap.set("n", lhs, rhs, { silent = true, buffer = bufnr, desc = desc })
13end
14
15M.set_leader = function(key)
16 vim.g.mapleader = key
17 vim.g.maplocalleader = key
18 M.map({ "n", "v" }, key, "<nop>")
19end
20
21return M