aboutsummaryrefslogtreecommitdiff
path: root/lua/plugins/maps.lua
blob: 7c5f29b31076ae4ae76138889c925cc3eae95b94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
local M = {}
local maps = {}

maps.gitsigns = {
        n = {
                ["<leader>gb"] = {
                        function()
                                package.loaded.gitsigns.blame_line()
                        end,
                        "Blame line",
                },

                ["<leader>td"] = {
                        function()
                                require("gitsigns").toggle_deleted()
                        end,
                        "Toggle deleted",
                },
        },
}

M.load = function(name, opts)
        local submaps = maps[name]
        opts = opts or {}

        vim.schedule(function()
                for mode, keytab in pairs(submaps) do
                        for key, fun in pairs(keytab) do
                                vim.keymap.set(mode, key, fun[1], { desc = fun[2] }, opts)
                        end
                end
        end)
end

return M