Friday, July 16, 2010

Re: format c program

On 17/07/10 03:41, bill lam wrote:
> I want to edit and format (pretty print) someone else c programs.
> It should use hard-tab and tabstop=8, but indentation sometime use tab
> while sometime use spaces, like
>
> /* return a pointer to a cell's [struct ent *], creating if needed */
> struct ent *
> lookat(int row, int col)
> {
> register struct ent **pp;
>
> checkbounds(&row,&col);
> pp = ATBL(tbl, row, col);
> if (*pp == NULL) {
> if (freeents != NULL) {
> *pp = freeents;
> (*pp)->flags&= ~is_clear;
> (*pp)->flags |= may_sync;
> freeents = freeents->next;
> } else
> *pp = (struct ent *) scxmalloc((unsigned)sizeof(struct ent));
> if (row> maxrow) maxrow = row;
> if (col> maxcol) maxcol = col;
> (*pp)->label = (char *)0;
>
> I'm not sure what indentation style it is called, but want to reformat
> it. using gq seems like format it as text. Any idea how to do it?
>

see :help =


Best regards,
Tony.
--
"When I die, I want a tombstone that says "GAME OVER" - Ton Richters

--
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: