google stype: 使用clang-format自动进行代码对齐。以下是具体配置:
安装VSCode:官网目前有Linux/Mac/Windows版本,现在对应版本安装即可。
安装cpptools: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
配置settings.json(File > Preferences > User Settings)是这样的:
// Place your settings in this file to overwrite the default settings
{
"editor.renderWhitespace": "boundary",
"editor.rulers": [80, 100]
}
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -1
IndentWidth: 2
TabWidth: 2
UseTab: Never
将该文件放在你代码目录或者其上层目录(建议直接放在home目录)。下次编辑c++代码时,按Ctrl+Shift+I即可安装该配置自动对齐。
See keyboard shortcut: https://code.visualstudio.com/docs/languages/cpp