aboutsummaryrefslogtreecommitdiff
path: root/lua/core/maps.lua
blob: 8c291e424d79bb0c242f4ef25c4c9b279c0e7a18 (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
36
37
38
39
local maps = {
	n = {
		["<Esc>"] = { "<CMD> noh <CR>", "Clear highlights" },
		["[b"] = { "<CMD> bprev <CR>", "Previous buffer" },
		["]b"] = { "<CMD> bnext <CR>", "Next buffer" },
		["<Leader>cc"] = {
			function()
				if vim.api.nvim_get_option_value("colorcolumn", {}) == "" then
					vim.api.nvim_set_option_value("colorcolumn", "80", {})
				else
					vim.api.nvim_set_option_value("colorcolumn", "", {})
				end
			end,
			"Toggle 80 column hint",
		},
		["<Leader>r"] = {
			vim.lsp.buf.rename,
			"Rename with LSP"
		},
	},

	t = {
		["<C-x>"] = {
			vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true),
			"Escape terminal mode",
		},
	},

	v = {
		["<"] = { "<gv", "Indent line" },
		[">"] = { ">gv", "Indent line" },
	},
}

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