Re: reformat c code
Thanks Ben, That is what I needed On Oct 26, 8:42 am, Ben Schmidt [EMAIL PROTECTED] wrote: Hi, a beginner question, can I reformat entire file code from: if (...) { // some action } to: if (...) { // some action } Thanx. The '=' command will reformat code. gg=G will do from top to bottom (whole file). But you have to set the indent options to what you want using the :set command, and make sure C indenting is turned on. See :help cindent :help cinoptions :help cinoptions-values For even more info, see :help C-indenting However...for this particular problem, I would do it differently so as to preserve any other formatting. I would just join lines which begin with '{' to the line above: :g/^\s*{/.-1join Ben. Send instant messages to your online friendshttp://au.messenger.yahoo.com --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: reformat c code
Hi, a beginner question, can I reformat entire file code from: if (...) { // some action } to: if (...) { // some action } Thanx. The '=' command will reformat code. gg=G will do from top to bottom (whole file). But you have to set the indent options to what you want using the :set command, and make sure C indenting is turned on. See :help cindent :help cinoptions :help cinoptions-values For even more info, see :help C-indenting However...for this particular problem, I would do it differently so as to preserve any other formatting. I would just join lines which begin with '{' to the line above: :g/^\s*{/.-1join Ben. Send instant messages to your online friends http://au.messenger.yahoo.com --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: reformat c code
i think the indent utility may help 2007/10/26, Gary Johnson [EMAIL PROTECTED]: On 2007-10-26, Ben Schmidt [EMAIL PROTECTED] wrote: Hi, a beginner question, can I reformat entire file code from: if (...) { // some action } to: if (...) { // some action } Thanx. The '=' command will reformat code. The '=' command does not reformat code--it indents code. In particular, the '=' command will not move the opening brace from one line to another. Regards, Gary --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: reformat c code
On 2007-10-26, Ben Schmidt [EMAIL PROTECTED] wrote: Hi, a beginner question, can I reformat entire file code from: if (...) { // some action } to: if (...) { // some action } Thanx. The '=' command will reformat code. The '=' command does not reformat code--it indents code. In particular, the '=' command will not move the opening brace from one line to another. Regards, Gary --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---
Re: reformat c code
The '=' command does not reformat code--it indents code. In particular, the '=' command will not move the opening brace from one line to another. O yeah. Duh. What was I thinking?! Maybe I was thinking of gq and some set of formatoptions that might possibly make it work...dunno...never really played with it; have never had the need! Ben. Send instant messages to your online friends http://au.messenger.yahoo.com --~--~-~--~~~---~--~~ You received this message from the vim_dev maillist. For more information, visit http://www.vim.org/maillist.php -~--~~~~--~~--~--~---