nvim: Fix LSP formatting messing up alternate file

This commit is contained in:
Andreas Tsouchlos 2025-07-25 15:00:06 -04:00
parent 6f1910c323
commit 2fb9f3f9e6

View File

@ -48,11 +48,19 @@ vim.api.nvim_create_autocmd('LspAttach', {
end end
vim.keymap.set('n', '<M-L>', vim.keymap.set('n', '<M-L>',
function() vim.lsp.buf.format({ bufnr = args.buf, timeout_ms = 1000 }) end, function() vim.lsp.buf.format() end,
{ desc = "Format" }) {
desc = "Format",
noremap = true,
silent = true
})
vim.keymap.set('i', '<M-L>', vim.keymap.set('i', '<M-L>',
function() vim.lsp.buf.format({ bufnr = args.buf, timeout_ms = 1000 }) end, function() vim.lsp.buf.format() end,
{ desc = "Format" }) {
desc = "Format",
noremap = true,
silent = true
})
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, { vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, {
desc = "Go to definition" desc = "Go to definition"