aboutsummaryrefslogtreecommitdiffstats
path: root/nvim/lua/keymap.lua
diff options
context:
space:
mode:
authorJean-Pierre Appel <jeanpierre.appel01@gmail.com>2023-02-21 01:04:26 -0500
committerJean-Pierre Appel <jeanpierre.appel01@gmail.com>2023-02-21 01:04:26 -0500
commit11b04ad1e5ef81d42c4384af94d7ba4161f0c160 (patch)
tree1438bb5285499d984db60a29ec18eded634c9bf4 /nvim/lua/keymap.lua
parent118592d53cb9a509831030de348963029aa603a8 (diff)
Added nvim and tmux config
Diffstat (limited to 'nvim/lua/keymap.lua')
-rw-r--r--nvim/lua/keymap.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/nvim/lua/keymap.lua b/nvim/lua/keymap.lua
new file mode 100644
index 0000000..883321b
--- /dev/null
+++ b/nvim/lua/keymap.lua
@@ -0,0 +1,22 @@
+-- Provides convienent lua methods for binding keys
+-- Source: Primeagen
+local M = {}
+
+local function bind(op, outer_opts)
+ outer_opts = outer_opts or {noremap = true}
+ return function(lhs, rhs, opts)
+ opts = vim.tbl_extend("force",
+ outer_opts,
+ opts or {}
+ )
+ vim.keymap.set(op, lhs, rhs, opts)
+ end
+end
+
+M.nmap = bind("n", {noremap = false})
+M.nnoremap = bind("n")
+M.vnoremap = bind("v")
+M.xnoremap = bind("x")
+M.inoremap = bind("i")
+
+return M