NVim: lsp format on save

This commit is contained in:
Filippo Berto 2024-01-14 13:55:56 +01:00
parent 06722274f9
commit 39fc8af382
No known key found for this signature in database
GPG key ID: FE98AE5EC52B1056
2 changed files with 4 additions and 1 deletions

View file

@ -1,6 +1,6 @@
local lspconfig = require('lspconfig')
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lsp_format = require("lsp-format")
-- Keymaps
local keymap = vim.keymap
@ -8,6 +8,8 @@ local opts = { noremap = true, silent = true }
local on_attach = function(client, bufnr)
opts.buffer = bufnr
lsp_format.on_attach(client, bufrn)
opts.desc = "Show LSP references"
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts)
opts.desc = "Go to declaration"