blob: d87b32c13ee47d4dc0173af329c595491619a366 (
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
31
32
33
34
35
36
37
38
39
40
|
;; 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 :ge "<cmd>lua vim.lsp.buf.rename()<cr>" {:desc :Rename}]
[:n
:<leader>a
"<cmd>lua vim.lsp.buf.code_action()<cr>"
{:desc "Code Action"}]
[:v
:<leader>e
"<cmd>lua vim.lsp.buf.format { async = true }<cr>"
{:desc :Format}]
[:n
:<leader>i
"<cmd>lua vim.lsp.codelens.run()<cr>"
{:desc "Code Lens"}]
[: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}
|