Bug 325807 - Add C++ Source Code Formatting with clang-format
Summary: Add C++ Source Code Formatting with clang-format
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: indentation (show other bugs)
Version: 3.10.5
Platform: Debian unstable Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-09 11:47 UTC by houz
Modified: 2020-12-13 13:21 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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