2020-11-30 VS Code 設定Linux風格

sheng8sheng8發表於2020-11-30

快捷鍵Shift + Alt + F

開啟檔案->首選項->設定或者快捷鍵Ctrl + ,搜尋設定clang如下圖

在上圖中 C_Cpp:Clang_format_style下面的輸入框中輸入:

{ 
 	BasedOnStyle: Google, 
 	UseTab: Never, 
 	IndentWidth: 4,
  	TabWidth: 4, 
   	AllowShortIfStatementsOnASingleLine: false, 
    ColumnLimit: 0
}

設定為Google排版方式

//Linux kernel style,Linux 核心排版樣式
{
    BasedOnStyle: LLVM,
    IndentWidth: 4,
    ColumnLimit: 0,
    UseTab: Never,
    BreakBeforeBraces: Linux,
    AllowShortIfStatementsOnASingleLine: false,
    IndentCaseLabels: false,
    AlignConsecutiveMacros: true
}
{
    BasedOnStyle: WebKit,
    UseTab: Never,
    IndentWidth: 4,
    TabWidth: 4,
    AllowShortIfStatementsOnASingleLine: false,
    ColumnLimit: 0,
    DerivePointerAlignment: false,
    PointerAlignment: Right,
    AlignAfterOpenBracket: Align,
    AlignConsecutiveMacros: true
}

參考連結 https://blog.csdn.net/whuer_xiaojie/article/details/105163144

相關文章