blob: 73cbf94c8942a8c0ab4b479c20550486e41fb7ae (
plain)
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
26
27
28
29
30
|
;; Key mappings for lsp.
(local opts {:noremap true :silent true})
(local mappings
[[:n :gD "<cmd>lua vim.lsp.buf.declaration()<CR>" {:desc :Declaration}]
[:n :gd "<cmd>lua vim.lsp.buf.definition()<CR>" {:desc :Definition}]
[:n
:gI
"<cmd>lua vim.lsp.buf.implementation()<CR>"
{:desc :Implementation}]
[:n :gr "<cmd>lua vim.lsp.buf.references()<CR>" {:desc :References}]
[:n
:gl
"<cmd>lua vim.diagnostic.open_float()<CR>"
{:desc :Diagnostics}]
[:n :gs "<cmd>lua vim.lsp.buf.signature_help()<CR>" {:desc :Signature}]
[:n :gh "<cmd>lua vim.lsp.buf.code_action()<cr>" {:desc "Code Action"}]
[:n :gb "<cmd>lua vim.lsp.codelens.run()<cr>" {:desc "Code Lens"}]
[:n :K "<cmd>lua vim.lsp.hover()<cr>" {:desc "Hover documentation"}]
[:n :<leader>li :<cmd>LspInfo<cr> {:desc "Lsp Info"}]])
(fn on-attach [buffer]
(each [_ mapping (ipairs mappings)]
(match mapping
[mode key cmd desc] (vim.api.nvim_buf_set_keymap buffer mode key cmd
(vim.tbl_extend :force
opts desc)))))
{: on-attach}
|