Thursday, November 26, 2009

Re: Correct easily if without block instructions code

On Thu, Nov 26, 2009 at 11:06 AM, epanda <callingelvis@hotmail.fr> wrote:
> I would like to know if I have to add instructions bloc in this case :
>
> if ( cond1 &&
>             cond2 )
>
> /* general comment
>   // a comment
>
> *
> */
>
> return result;
>
>
> ==> has to become
>
> if ( cond1 &&
>             cond2 )
> {
>    /* general comment
>       // a comment
>
>     *
>     */
>      return result;
> }
>

If I understood you well, you need to surround some lines of code
between braces. That can be done with the surround plugin as follows:
- select the lines of text you wish to surround
- type s{

To indent properly, you can type vi{ to select the block of text
between braces, and then type = (or shift+>) to indent correctly.

bye.

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: