Aligning C function parameters with vim
December 7th, 2009
updated: now saves/retores the paste register
It has bothered me for a while, some coding styles, most notably in the GNOME world try to enforce good looking alignment of functions parameters such as:
static UniqueResponse
on_unique_message_received (UniqueApp *unique_app,
gint command,
UniqueMessageData *message_data,
guint time_,
gpointer user_data)
{
}
Until now, I aligned the arguments by hand, but that time is over! Please welcome my first substantial vim plugin: it defines a GNOMEAlignArguments command to help you in that task. All you have to do is to add this file in your ~/.vim/plugin directory and define a macro in your ~/.vimrc to invoke it just like this:
" Align arguments nmap ,a :GNOMEAlignArguments<CR>
HTH.
Thanks for the cool plugin, it works like a charm.
@Jannis
You should re-download it again, now it saves/restore the paste register, newbie mistake.
Can you make one for gedit too?
Hi,
Is there a way to make it aligne parameters in function calling?
eg:
output_stream = gdata_upload_stream_new (GDATA_SERVICE (service),
SOUP_METHOD_POST,
upload_uri,
NULL,
title)
l
output_stream = gdata_upload_stream_new (GDATA_SERVICE (service),
SOUP_METHOD_POST,
upload_uri,
NULL,
title)
It would be awesame
Anyway thanks lot for this cool plugin
OOOOps sorry my last post wasen’t that explainfull,
Here is the explainfull code sample: http://pastebin.com/f4516bb35
Thx
@thilahute
yup, that’s the (0 option of cinoptions. (and then = to indent, of course)
@damien, oops was so simple