mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-25 14:13:37 -05:00
feat(format): add :lang cc formatter
This commit is contained in:
@@ -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.")))
|
||||
|
Reference in New Issue
Block a user