summaryrefslogtreecommitdiff
path: root/dot_config/nvim/lua/bindings.lua
blob: eb579f9fff7899e5d2b64fcd67efdaced1ea7142 (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
local util = require 'util'

local env = vim.env

-- TODO: write a wrapper for both
if not util.hp 'which-key.nvim' then
	-- minimal bindings for a no-plugin environment
	local km = vim.keymap.set
	km('n', '<leader>sv', function() dofile(env.MYVIMRC) end, { desc = 'source vimrc'})
	km('n', '<leader>s%', '<cmd>source %<cr>', { desc = 'source current file'})
else
	-- general bindings that aren't specific to a plugin
	require 'which-key'.register {
		['<leader>s'] = {
			name = '+source',
			v = { function() dofile(env.MYVIMRC) end, 'Vimrc' },
			['%'] = { '<cmd>source %<cr>', 'Current File' },
		},
		-- document missing builtins
		['g'] = {
			t = 'Next tab',
			T = 'Previous tab',
		},
	}
end