feat(format): add :lang cc formatter
This commit is contained in:
parent
cd79edf134
commit
bfb963f2f3
2 changed files with 16 additions and 0 deletions
|
@ -48,6 +48,18 @@ This is ignored by ccls.")
|
|||
(set-docsets! 'c-mode "C")
|
||||
(set-docsets! 'c++-mode "C++" "Boost")
|
||||
(set-electric! '(c-mode c++-mode objc-mode java-mode) :chars '(?\n ?\} ?\{))
|
||||
(when (executable-find "clang-format")
|
||||
(set-formatter!
|
||||
'clang-format
|
||||
'("clang-format"
|
||||
"-assume-filename"
|
||||
(or (buffer-file-name)
|
||||
(cdr (assoc major-mode
|
||||
'((c-mode . ".c")
|
||||
(c++-mode . ".cpp")
|
||||
(cuda-mode . ".cu")
|
||||
(protobuf-mode . ".proto"))))))
|
||||
:modes '(c-mode c++-mode protobuf-mode cuda-mode)))
|
||||
(set-rotate-patterns! 'c++-mode
|
||||
:symbols '(("public" "protected" "private")
|
||||
("class" "struct")))
|
||||
|
|
|
@ -26,3 +26,7 @@
|
|||
;; glslangValidator
|
||||
(unless (executable-find "glslangValidator")
|
||||
(warn! "Couldn't find glslangValidator. GLSL code completion is disabled")))
|
||||
|
||||
(when (modulep! :editor format)
|
||||
(unless (executable-find "clang-format")
|
||||
(warn! "Couldn't find clang-format. Formatting will be disabled.")))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue