summaryrefslogtreecommitdiff
path: root/fnl/plugins/lsp/keymaps.fnl
blob: 9b95140464e99119ec1eab5eaa8de98dd2922093 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;; Key mappings for lsp.

(local opts {:noremap true :silent true})

(local mappings
       [[:n :gD "<cmd>lua vim.lsp.buf.declaration()<CR>"]
        [:n :gd "<cmd>lua vim.lsp.buf.definition()<CR>"]
        [:n :gI "<cmd>lua vim.lsp.buf.implementation()<CR>"]
        [:n :gr "<cmd>lua vim.lsp.buf.references()<CR>"]
        [:n :gl "<cmd>lua vim.diagnostic.open_float()<CR>"]
        [:n :gs "<cmd>lua vim.lsp.buf.signature_help()<CR>"]])

(fn buf-set-keymap [bufnr mode key cmd opts]
  (vim.api.nvim_buf_set_keymap bufnr mode key cmd opts))

(fn on-attach [bufnr]
  (each [_ mapping (ipairs mappings)]
    (match mapping
      [mode key cmd] (buf-set-keymap bufnr mode key cmd opts))))

{: on-attach}