Re: C++: Indenting and formatting program sources.
On Sun, 18 Nov 2001 17:24:22 +0200, you wrote:
>Can anyone recommend a program to indent and format C++ program sources
>for consistency of style and perhaps better readability?
>Specifying the used options or attaching a suitable configuration file
>(like a .ident.pro for GNU indent) is desirable.
>
>GNU indent does not targeted directly to C++ code. Is this a problem?
>The only official deb that I found for this task is astyle. I have not
>tried it yet. Are there others? Are there commonly used programs for
>this task that are not debianized?
>The LDP C-C++ Beautifier HOW-TO mentions bcpp. Is it commonly used?
>
>Is there a way to have vim force a standard and consistent style? Once
>again, attaching a configuration file or pointing out to a standard one
>is desirable.
>--
>
> Shaul Karl
> email: shaulka (replace these parenthesis with @) bezeqint,
> delete the comma and the white space characters and add .net
Ignore this if I am not understanding the question. It looks to me like
all you need to do is open the file in emacs, select the entire file,
and invoke indent-region (check the syntax). There is a built library
of styles to choose from; a default, K&R, GNU, and others. Opening
files with C/C++ extensions automatically puts you in C/C++ mode.
As for extending vim for this, I have not a clue. For its ease of use
in writing formatted code in any number of languages, try emacs even if
you prefer vim for ordinary tasks.
gt
Yes I fear I am living beyond my mental means--Nash
Reply to: