summaryrefslogtreecommitdiff
path: root/lua/aotrix/plugins/autoformat.lua
blob: ce2ece3eba107165cd09ce4bbfa744c138340cb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
return {
    "stevearc/conform.nvim",
    opts = {
        notify_on_error = false,
        format_on_save = {timeout_ms = 500, lsp_fallback = true},
        formatters_by_ft = {
            lua = {"lua-format"},
            cpp = {"clang_format"},
            cmake = {"gersemi"}
        },
        formatters = {
            clang_format = {
                prepend_args = {
                    '--style={IndentWidth: 4, ColumnLimit: 100, BreakBeforeBraces: Allman, AlignAfterOpenBracket: true, AlignConsecutiveAssignments: true, BreakAfterAttributes: Always, BinPackParameters: AlwaysOnePerLine, AllowShortFunctionsOnASingleLine: None, AllowShortIfStatementsOnASingleLine: Never, PointerAlignment: Left, SeparateDefinitionBlocks: Always}'
                }
            },
            shfmt = {prepend_args = {'-i', '4'}}
        }
    }
}