diff options
Diffstat (limited to 'dot_config/nvim/lua')
| -rw-r--r-- | dot_config/nvim/lua/bindings/builtins.lua | 7 | ||||
| -rw-r--r-- | dot_config/nvim/lua/bindings/init.lua | 18 | ||||
| -rw-r--r-- | dot_config/nvim/lua/bindings/plugins.lua | 6 | ||||
| -rw-r--r-- | dot_config/nvim/lua/bindings/readline.lua | 10 | ||||
| -rw-r--r-- | dot_config/nvim/lua/plugins/bindings.lua | 11 | ||||
| -rw-r--r-- | dot_config/nvim/lua/plugins/telescope.lua | 17 |
6 files changed, 69 insertions, 0 deletions
diff --git a/dot_config/nvim/lua/bindings/builtins.lua b/dot_config/nvim/lua/bindings/builtins.lua new file mode 100644 index 0000000..330666e --- /dev/null +++ b/dot_config/nvim/lua/bindings/builtins.lua @@ -0,0 +1,7 @@ +-- document missing builtins +require 'which-key'.register { + ['g'] = { + t = 'Next tab', + T = 'Previous tab', + }, +} diff --git a/dot_config/nvim/lua/bindings/init.lua b/dot_config/nvim/lua/bindings/init.lua new file mode 100644 index 0000000..622f23d --- /dev/null +++ b/dot_config/nvim/lua/bindings/init.lua @@ -0,0 +1,18 @@ +for _, v in ipairs { + 'builtins', + 'plugins', + 'readline', +} do + require ('bindings.' .. v) +end + +-- general bindings that aren't specific to a plugin +require 'which-key'.register { + -- diagnostics + ['<leader>'] = { + e = { vim.diagnostic.open_float, 'diag float' }, + q = { vim.diagnostic.setloclist, 'diag locations' }, + }, + ['[d'] = { vim.diagnostic.goto_prev, 'prev diag' }, + [']d'] = { vim.diagnostic.goto_next, 'next diag' }, +} diff --git a/dot_config/nvim/lua/bindings/plugins.lua b/dot_config/nvim/lua/bindings/plugins.lua new file mode 100644 index 0000000..52894a7 --- /dev/null +++ b/dot_config/nvim/lua/bindings/plugins.lua @@ -0,0 +1,6 @@ +-- plugin-specific category bindings +require 'which-key'.register { + ['<leader>'] = { + f = '+find', + }, +} diff --git a/dot_config/nvim/lua/bindings/readline.lua b/dot_config/nvim/lua/bindings/readline.lua new file mode 100644 index 0000000..64e3042 --- /dev/null +++ b/dot_config/nvim/lua/bindings/readline.lua @@ -0,0 +1,10 @@ +local readline = require 'readline' +vim.keymap.set('!', '<M-Right>', readline.forward_word) +vim.keymap.set('!', '<M-Left>', readline.backward_word) +vim.keymap.set('!', '<C-a>', readline.beginning_of_line) +vim.keymap.set('!', '<C-e>', readline.end_of_line) +vim.keymap.set('!', '<M-d>', readline.kill_word) +vim.keymap.set('!', '<M-BS>', readline.backward_kill_word) +vim.keymap.set('!', '<C-w>', readline.unix_word_rubout) +vim.keymap.set('!', '<C-k>', readline.kill_line) +vim.keymap.set('!', '<C-u>', readline.backward_kill_line) diff --git a/dot_config/nvim/lua/plugins/bindings.lua b/dot_config/nvim/lua/plugins/bindings.lua new file mode 100644 index 0000000..1b4a06c --- /dev/null +++ b/dot_config/nvim/lua/plugins/bindings.lua @@ -0,0 +1,11 @@ +return { + { + 'folke/which-key.nvim', + lazy = true, + opts = {}, + }, + { + 'linty-org/readline.nvim', + lazy = true, + }, +} diff --git a/dot_config/nvim/lua/plugins/telescope.lua b/dot_config/nvim/lua/plugins/telescope.lua index 8849542..bc760de 100644 --- a/dot_config/nvim/lua/plugins/telescope.lua +++ b/dot_config/nvim/lua/plugins/telescope.lua @@ -1,3 +1,11 @@ +local function gen(key, fn, desc) + return {'<leader>f' .. key, + function() + require 'telescope.builtin'[fn]() + end, + desc = desc} +end + return { { 'nvim-telescope/telescope.nvim', @@ -13,5 +21,14 @@ return { ts.setup(opts) ts.load_extension 'fzf' end, + cmd = 'Telescope', + keys = { + gen('f', 'find_files', 'Find File'), + gen('g', 'live_grep', 'Live Grep'), + gen('b', 'buffers', 'Find Buffer'), + gen('h', 'help_tags', 'Find Help'), + gen('c', 'commands', 'Find Command'), + gen('t', 'treesitter', 'Find Treesitter'), + }, }, } |
