Eclipse CDT 用のフォーマッターをインストールしたので,そのメモ.
1. Install Clang-format
まずは下記のコマンドで Clang-format をインストールします.
$ sudo apt-get install clang-foramt
2. Eclipse のプラグイン CPPStyle を Eclipse からインストール.
Help -> Install NEW Software -> 下記の URL を新たなリポジトリとして加える.
http://wangzw.github.io/CppStyle/update
使用条件に同意して Finish.
3. CPPStyle にて Clang-format を選択する.
Window -> Preferences -> C/C++ -> CppStyle
"Clang-format path" にインストールしたバイナリファイルを指定.
"Run clang-format on file save"にチェックを入れて OK を押して完了.
4. Formatter として CPPStyle を選択する.
Window -> Preferences -> C/C++ -> Code Style -> Formatter
"Code Formatter" というダイアログがあるので,そこで "CppStyle" を選択し,Apply, OK として設定完了.