;; Key mappings for lsp. (local opts {:noremap true :silent true}) (local mappings [[:n :gD "lua vim.lsp.buf.declaration()"] [:n :gd "lua vim.lsp.buf.definition()"] [:n :gI "lua vim.lsp.buf.implementation()"] [:n :gr "lua vim.lsp.buf.references()"] [:n :gl "lua vim.diagnostic.open_float()"] [:n :gs "lua vim.lsp.buf.signature_help()"]]) (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}