Added instructions for newer clang-format
dblume

dblume commited on 2023-08-13 16:53:29
Showing 2 changed files, with 11 additions and 4 deletions.

... ...
@@ -12,7 +11,7 @@ AllowShortLoopsOnASingleLine: false
12 11
 BinPackArguments: true
13 12
 BinPackParameters: true
14 13
 
15
-# PackConstructorInitializers: NextLine  # <-- Preferred, but in v14
14
+PackConstructorInitializers: NextLine  # available in v14
16 15
 
17 16
 # Support vim navigation with [[ and ]]
18 17
 BreakBeforeBraces: Custom
... ...
@@ -60,19 +60,26 @@ Or, if it's not in your path, something like...
60 60
 
61 61
 ### Formatting
62 62
 
63
-Use clang-format. Install with:
63
+Use clang-format. Install the distro's version with:
64 64
 
65 65
     sudo apt install clang-format
66 66
 
67
+Or install a newer one (replace 17 with whatever's current now) with:
68
+
69
+    wget https://apt.llvm.org/llvm.sh
70
+    chmod +x llvm.sh
71
+    sudo ./llvm.sh 17
72
+    sudo apt install clang-format-17
73
+
67 74
 Then, after making your edits, use the [vim integration](https://clang.llvm.org/docs/ClangFormat.html#vim-integration) or manually format with:
68 75
 
69 76
     git status --porcelain | \
70 77
     awk 'match($1, "M|A") && match($2, "(c|h)(pp)?$"){print $2}' | \
71
-    xargs clang-format -style=file -i
78
+    xargs clang-format-17 -style=file -i
72 79
 
73 80
 Or, shorter but less comprehensive:
74 81
 
75
-    git ls-files -m | egrep ".(c|h)(pp)?$" | xargs clang-format -style=file -i
82
+    git ls-files -m | egrep ".(c|h)(pp)?$" | xargs clang-format-17 -style=file -i
76 83
 
77 84
 ### Other IDEs
78 85
 
79 86