On Sun, 28 Jan 2007 10:01:18 +0300, Ilia N Ternovich wrote:
> On Fri, 26 Jan 2007 07:14:53 +0000
> Spencer Collyer <[EMAIL PROTECTED]> wrote:
> 
> > It'll be a good introduction to programming Vim for me
> 
> If it's possible, post here results of your work...
> I also have those troubles while working with C++
> 
> 
> 

Well I finally got around to sorting something out for this. Attached
is my first attempt at solving this problem.

For those who missed the start of the thread, a short example of what
I'm trying to do.

When writing multi-line function calls, I like to lay them out with the
separating comma on the same line as the following parameter, like so:

        ret = some_func( param1
                       , param2
                       , param3
                       );

but unfortunately VIM always reformats these like this:

        ret = some_func( param1
                         , param2
                         , param3
                       );

i.e. each comma is below the first parameter name, not the opening
parenthesis.

So I created the attached script, which goes in my .vim/after/indent
directory. Feel free to use it if you want. If you do, make sure you
have a  'filetype indent on' line in your .vimrc.

As well as aligning commas, it also handles multi-line '<<' and '>>'
I/O operations, where the first '<<' or '>>' is aligned below the first
one on the preceding line.

No doubt there are bugs in here that I haven't hit because of my coding
style, but hopefully it will at least give a starting point for others
if they need this functionality.

Spencer

-- 
<<< Eagles may soar, but weasels don't get sucked into jet engines >>>
7:17am up 29 days 14:00, 18 users, load average: 0.22, 0.28, 0.11
Registered Linux User #232457 | LFS ID 11703

Reply via email to