From 11532d7984fcd985fb7db80232f474181a122ec3 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Sun, 1 Sep 2024 17:36:15 -0300 Subject: [PATCH] neovim: add clang_format and enable auto format --- programs/neovim/lua/plugins/astrolsp.lua | 5 ++++- programs/neovim/lua/plugins/none-ls.lua | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/programs/neovim/lua/plugins/astrolsp.lua b/programs/neovim/lua/plugins/astrolsp.lua index 91af45e..afd011e 100644 --- a/programs/neovim/lua/plugins/astrolsp.lua +++ b/programs/neovim/lua/plugins/astrolsp.lua @@ -22,14 +22,17 @@ return { enabled = true, -- enable or disable format on save globally allow_filetypes = { -- enable format on save for specified filetypes only -- "go", + "c", + "cpp", + "h", "javascript", "jsx", "lua", "nix", "rust", + "svelte", "tsx", "typescript", - "svelte", }, ignore_filetypes = { -- disable format on save for specified filetypes -- "python", diff --git a/programs/neovim/lua/plugins/none-ls.lua b/programs/neovim/lua/plugins/none-ls.lua index 6132628..5601ff7 100644 --- a/programs/neovim/lua/plugins/none-ls.lua +++ b/programs/neovim/lua/plugins/none-ls.lua @@ -12,6 +12,7 @@ return { -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics config.sources = { -- Set a formatter + null_ls.builtins.formatting.clang_format, null_ls.builtins.formatting.nixfmt, null_ls.builtins.formatting.prettier, null_ls.builtins.formatting.stylua,