Bug 325807

Summary: Add C++ Source Code Formatting with clang-format
Product: [Applications] kate Reporter: houz
Component: indentationAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: christoph, codestruct, houz, i.zaufi, waqar.17a
Priority: NOR    
Version: 3.10.5   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description houz 2013-10-09 11:47:34 UTC
There is a nice tool called clang-format [0] that allows indenting and also formatting code. It provides plugins for vim and emacs so I wonder if it might be possible to support it in kate, too?

[0] http://clang.llvm.org/docs/ClangFormat.html

Reproducible: Always
Comment 1 Alex Turbov 2013-10-30 19:38:27 UTC
you can use it already via Text Filter plugin
Comment 2 Christoph Cullmann 2015-08-01 21:10:41 UTC
>houz@gmx.de 2013-10-09 11:47:34 UTC
>....
As I somehow know, that you can program C++ yourself, might you want to submit some patch? ;=)
Comment 3 Gregor Mi 2018-12-16 20:53:53 UTC
"Text Filter" does not work when only a part of the source code is selected because clang-format needs the whole file as context.

Ideally, there would also be a keyboard shortcut to invoke this "Format Selection" action.
Comment 4 Waqar Ahmed 2020-12-13 13:21:56 UTC
This is fixed with the "External Tools" plugin and should be closed.

Selected text can be formatted using:

Menu -> Tools -> External Tools -> Tools -> Clang Format Selected Text