diff --git a/bundle/format.nvim/lua/format/ft/c.lua b/bundle/format.nvim/lua/format/ft/c.lua new file mode 100644 index 000000000..23eb8c109 --- /dev/null +++ b/bundle/format.nvim/lua/format/ft/c.lua @@ -0,0 +1,31 @@ +local M = {} + +function M.enabled() + return { 'uncrustify', 'clangformat', 'astyle' } +end + +function M.clangformat(opt) + return { + exe = 'clang-format', + args = { '-assume-filename=' .. opt.filepath }, + stdin = true, + } +end + +function M.uncrustify(opt) + return { + exe = 'uncrustify', + args = { '-q', '-l', 'C' }, + stdin = true, + } +end + +function M.astyle(opt) + return { + exe = 'astyle', + args = {'--mode=c'}, + stdin = true + } +end + +return M