diff options
-rw-r--r-- | .config/nvim/init.lua | 15 |
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 |