31 buffer = args.buf, |
31 buffer = args.buf, |
32 callback = vim.diagnostic.open_float, |
32 callback = vim.diagnostic.open_float, |
33 }) |
33 }) |
34 end, |
34 end, |
35 }) |
35 }) |
36 |
|
37 -- Format on write, but only certain languages |
|
38 local autoformat_filetypes = { elixir = true, go = true } |
|
39 |
|
40 vim.api.nvim_create_autocmd("BufWritePre", { |
|
41 group = vim.api.nvim_create_augroup("lsp_autoformat", { clear = true }), |
|
42 callback = function() |
|
43 if autoformat_filetypes[vim.bo.filetype] then |
|
44 vim.lsp.buf.format({ timeout_ms = 100 }) |
|
45 end |
|
46 end, |
|
47 }) |
|