On 28/09/12 22:36, Ben Fritz wrote:
<snip>
> Oops. Here's a tweak to not include the trailing whitespace within the comment:
>
> %s#\v/\*(%(%(\*/)@!.){-})\s*\*/\s*$#//\1
>
> (untested)
>
> As you can see, you can easily spend WAY to long tweaking these.
>
> Here I'm using a "non-greedy" regular expression, see :help /\{-
>
>> Now I need to align them. The NERD Commenter didn't work well for me.
>>
>> Pity, it looked as though it could solve my aligning problem.
>>
>> Now I need a K&R style to "braces horizontally aligned" brace conversion :=)
>>
>
> I'd understand your alignment problem better if you gave an example. But probably it's not something you should use regex to accomplish. There is an "Align" plugin by Dr. Chip but since I don't really understand your problem I'm not sure if it's useful:
>
> http://vim.sourceforge.net/scripts/script.php?script_id=294
>
You are right Ben,
For braces, I wanted to change e.g. :
func() {
body; }
to:
func()
{
body;
}
Marc Jessome suggested "http://astyle.sourceforge.net/" for this job and
it works like a charm for all possible brace combinations. It's not a
tool I knew of.
Thanks Marc.
Now for comments, I want to change:
// Comment1
// Comment2
to:
// Comment1
// Comment2
where I can specify ---------^ this column.
(Long source code lines wuill 'push' this to the right)
(Format might get mangled by mail/list) :=)
On 29/09/12 02:27, jreidthompson wrote:
> are you certain this code will never need to be compiled on an
"older" compiler? ISO C90 or earlier, any C compiler that will not
allow C++ style comments, etc???
Yes thanks, that is exactly why I want to convert the files.
I find the older styles harder to ascertain the logical flow in. (Just
my preference).
Many thanks to all,
Bob
--
The Sun is out, the sky is blue, it's time to drive the MR2.
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment