summaryrefslogtreecommitdiff
path: root/dot_config/nvim/lua/bindings.lua
diff options
context:
space:
mode:
Diffstat (limited to 'dot_config/nvim/lua/bindings.lua')
-rw-r--r--dot_config/nvim/lua/bindings.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/dot_config/nvim/lua/bindings.lua b/dot_config/nvim/lua/bindings.lua
new file mode 100644
index 0000000..eb579f9
--- /dev/null
+++ b/dot_config/nvim/lua/bindings.lua
@@ -0,0 +1,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