summaryrefslogtreecommitdiff
path: root/dot_config/nvim/lua/bindings.lua
diff options
context:
space:
mode:
authorChloe Kudryavtsev <code@toast.bunkerlabs.net>2022-11-08 13:06:08 -0500
committerChloe Kudryavtsev <code@toast.bunkerlabs.net>2022-11-08 13:06:08 -0500
commit946b25db1aa005bf072c3c468cb0641cf2fac45d (patch)
tree1afe414f65b2ff978cf3227ee424c21835158672 /dot_config/nvim/lua/bindings.lua
parentgit: update config (diff)
nvim: init bootstrappable config
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