I'm sure that there are vim plugins to do this. Search the
vim.org page for a vim script for automatic formatting that language you are programming in.
This vim list has a smaller audience as it primarily is related to the macvim port of vim.
Asking this question on the main vim list will get you a larger audience. After searching the vim scripts.
> --
> --
> You received this message from the "vim_mac" 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
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_mac" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
vim_mac+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.