debug and problems
This commit is contained in:
34
lua/plugins/config/conform.lua
Normal file
34
lua/plugins/config/conform.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
local conform = require("conform")
|
||||
|
||||
conform.setup({
|
||||
formatters_by_ft = {
|
||||
c = { "clang_format" },
|
||||
cpp = { "clang_format" },
|
||||
h = { "clang_format" },
|
||||
hpp = { "clang_format" },
|
||||
},
|
||||
format_on_save = function(bufnr)
|
||||
local ft = vim.bo[bufnr].filetype
|
||||
local cpp_filetypes = {
|
||||
c = true,
|
||||
cpp = true,
|
||||
h = true,
|
||||
hpp = true,
|
||||
}
|
||||
|
||||
if cpp_filetypes[ft] then
|
||||
return {
|
||||
timeout_ms = 1000,
|
||||
lsp_format = "fallback",
|
||||
}
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command("Format", function()
|
||||
conform.format({
|
||||
async = false,
|
||||
timeout_ms = 1000,
|
||||
lsp_format = "fallback",
|
||||
})
|
||||
end, {})
|
||||
Reference in New Issue
Block a user