aboutsummaryrefslogtreecommitdiff
path: root/lua/gabrielgio/key.lua
blob: ed683b12bb005a8676106dcaae8612b02af65ffc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
local function bind(op, outer_opts)
    local outer_opts0 = (outer_opts or {noremap = true})
    local function lo(lhs, rhs, opts)
        local opts0 = vim.tbl_extend("force", outer_opts0, (opts or {}))
        return vim.keymap.set(op, lhs, rhs, opts0)
    end
    return lo
end

local nmap = bind("n", {noremap = false})
local nnoremap = bind("n")
local vnoremap = bind("v")
local xnoremap = bind("x")
local inoremap = bind("i")
local tnoremap = bind("t")

return {
    nmap = nmap,
    nnoremap = nnoremap,
    tnoremap = tnoremap,
    vnoremap = vnoremap,
    xnoremap = xnoremap,
    inoremap = inoremap
}