aboutsummaryrefslogtreecommitdiff
path: root/lua/plugins/maps.lua
blob: 84a0703626b143e4a48cbf565eeeeddf85c1a963 (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