neovim: add clang_format and enable auto format

This commit is contained in:
Alexandre Cavalheiro 2024-09-01 17:36:15 -03:00
parent 79d396ddfd
commit 9ad02124d7
Signed by: wizardlink
GPG key ID: A5767B54367CFBDF
2 changed files with 5 additions and 1 deletions

View file

@ -22,14 +22,17 @@ return {
enabled = true, -- enable or disable format on save globally enabled = true, -- enable or disable format on save globally
allow_filetypes = { -- enable format on save for specified filetypes only allow_filetypes = { -- enable format on save for specified filetypes only
-- "go", -- "go",
"c",
"cpp",
"h",
"javascript", "javascript",
"jsx", "jsx",
"lua", "lua",
"nix", "nix",
"rust", "rust",
"svelte",
"tsx", "tsx",
"typescript", "typescript",
"svelte",
}, },
ignore_filetypes = { -- disable format on save for specified filetypes ignore_filetypes = { -- disable format on save for specified filetypes
-- "python", -- "python",

View file

@ -12,6 +12,7 @@ return {
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
config.sources = { config.sources = {
-- Set a formatter -- Set a formatter
null_ls.builtins.formatting.clang_format,
null_ls.builtins.formatting.nixfmt, null_ls.builtins.formatting.nixfmt,
null_ls.builtins.formatting.prettier, null_ls.builtins.formatting.prettier,
null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.stylua,