summaryrefslogtreecommitdiff
path: root/.config/nvim/init.lua
diff options
context:
space:
mode:
authorsinanmohd <sinan@firemail.cc>2023-10-04 09:01:23 +0530
committersinanmohd <sinan@firemail.cc>2023-10-04 09:01:23 +0530
commit139e9754b78a1119b61f45a798c2d265e0b0308c (patch)
tree81255ab6c6839b0771d1c4e9c641886f63879ead /.config/nvim/init.lua
parentce75801ca22f9b616f307a3b4849b4b690db43f5 (diff)
config/nvim: init table_merge
Diffstat (limited to '.config/nvim/init.lua')
-rw-r--r--.config/nvim/init.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index e2cac1a..5d2494e 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -18,13 +18,24 @@ vim.wo.relativenumber = true
vim.wo.signcolumn = "yes"
-- [[ lib ]]
+local table_merge = function (t1, t2)
+ t1 = t1 or {}
+ t2 = t2 or {}
+
+ for k, v in pairs(t2) do
+ t1[k] = v
+ end
+
+ return t1
+end
+
local map = function(mode, lhs, rhs, opts)
- opts = opts or { silent = true }
+ opts = table_merge(opts, { silent = true })
vim.api.nvim_set_keymap(mode, lhs, rhs, opts)
end
local mapnl = function(lhs, rhs, opts)
- opts = opts or { silent = true }
+ opts = table_merge(opts, { silent = true })
vim.keymap.set("n", "<leader>" .. lhs, rhs, opts)
end