Aligning C function parameters with vim

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 *messagedata,
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.


GNOME

104 Words

2009-12-07 12:56 +0000