nvim: remove dart, move autoformat extensions to var

This commit is contained in:
Vladan Popovic 2024-10-14 09:59:14 +02:00
parent 563995032c
commit a3b0b8754b

View file

@ -1,3 +1,5 @@
local autoformat_files = '*.py,*.rs,*.tf'
local common_on_attach = function(client, bufnr) local common_on_attach = function(client, bufnr)
-- Mappings. -- Mappings.
vim.keymap.set("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>") vim.keymap.set("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>")
@ -12,7 +14,7 @@ local common_on_attach = function(client, bufnr)
-- Autoformat on save. -- Autoformat on save.
if client.supports_method("textDocument/formatting") then if client.supports_method("textDocument/formatting") then
vim.api.nvim_create_autocmd("BufWritePre", { vim.api.nvim_create_autocmd("BufWritePre", {
pattern = '*.py,*.rs', pattern = autoformat_files,
callback = function() callback = function()
vim.lsp.buf.format() vim.lsp.buf.format()
end, end,
@ -32,7 +34,6 @@ local capabilities = vim.lsp.protocol.make_client_capabilities()
-- LSPs -- LSPs
local servers = { local servers = {
"clangd", "clangd",
"dartls",
"gleam", "gleam",
"lua_ls", "lua_ls",
"ocamllsp", "ocamllsp",