summaryrefslogtreecommitdiff
path: root/dot_config/nvim/lua/plugins/lsp/attach.lua
diff options
context:
space:
mode:
authorChloe Kudryavtsev <code@toast.bunkerlabs.net>2023-04-13 00:39:31 -0400
committerChloe Kudryavtsev <code@toast.bunkerlabs.net>2023-04-13 00:39:31 -0400
commit6273b6d43aedc6b00b82e1081db14c39194da765 (patch)
treec6b1b1e6f9391696001375cb93ecd34449eefe0c /dot_config/nvim/lua/plugins/lsp/attach.lua
parentnvim: add rudimentary treesitter folding support (diff)
nvim: redo the whole thing
reasons tm
Diffstat (limited to 'dot_config/nvim/lua/plugins/lsp/attach.lua')
-rw-r--r--dot_config/nvim/lua/plugins/lsp/attach.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/dot_config/nvim/lua/plugins/lsp/attach.lua b/dot_config/nvim/lua/plugins/lsp/attach.lua
new file mode 100644
index 0000000..66d5a44
--- /dev/null
+++ b/dot_config/nvim/lua/plugins/lsp/attach.lua
@@ -0,0 +1,36 @@
+return function(c, b)
+ local lsp = vim.lsp
+ local lbf = lsp.buf
+ local wk = require 'which-key'
+ vim.api.nvim_buf_set_option(b, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
+ wk.register({
+ name = '+lsp',
+ D = {lbf.declaration, 'goto declaration'},
+ d = {lbf.definition, 'goto definition'},
+ k = {lbf.hover, 'hover'},
+ K = {lbf.signature_help, 'signature help'},
+ i = {lbf.implementation, 'goto implementation'},
+ t = {lbf.type_definition, 'goto type definition'},
+ r = {lbf.rename, 'rename'},
+ c = {lbf.code_action, 'code action'},
+ R = {lbf.references, 'list references'},
+ w = {
+ name = '+workspace',
+ a = {lbf.add_workspace_folder, 'add folder'},
+ r = {lbf.remove_workspace_folder, 'remove folder'},
+ l = {
+ function() print(vim.inspect(lbf.list_workspace_folders())) end,
+ 'list folders'
+ },
+ },
+ }, {
+ prefix = '<localleader><localleader>',
+ buffer = b,
+ })
+ wk.register({
+ ['<leader>F'] = {
+ function() vim.lsp.buf.format {async = true} end,
+ 'run format',
+ },
+ }, { buffer = b })
+end