Late night. I just clone the pacman repository to see how pacman read the database file.
$ git clone https://gitlab.archlinux.org/pacman/pacman.git
The idea is I want to try replicate the library in Go.
When I opened one of the file
lib/libalpm/be_package.c in vim, I
accidentally hit CTRL+s (this is my shortcut for
:w in vim) due to habit,
and suddenly the file got auto-formatted due to vim-codefmt configuration that
I have in .vimrc,
augroup autoformat_settings autocmd FileType bzl AutoFormatBuffer buildifier autocmd FileType c,cpp,proto,arduino AutoFormatBuffer clang-format autocmd FileType dart AutoFormatBuffer dartfmt autocmd FileType go AutoFormatBuffer gofmt ...
The only way to undo this to git checkout the file.
Since I am curious, I see if I can format this at least in Linux kernel coding style, because the pacman coding style seems follow it too.
I see the man page, but there is no manual page for clang-format,
(ins) 1 $ man clang-format No manual entry for clang-format
clang-format -h, I see
--style=<string> - Coding style, currently supports: LLVM, GNU, Google, Chromium, Microsoft, Mozilla, WebKit.
Now, I need to download the file and figure it out how to incorporate it with vim-codefmt.
Do you know how much times I spend to figure this out?
This is where gofmt wins above all.
Imagine that if Go does not have it. One repository use their own style, another repository use their own style, and so on. Just like what we have in clang-format for C, there is style for LLVM, GNU (euw), Google, Chromium, and so on.
Thanks the Go authors that foreseen this issue long time ago.