当前位置: 技术问答>linux和unix
vi使用的问题,如何对一段进行操作?
来源: 互联网 发布时间:2015-07-23
本文导语: 比如有下面这段代码,每行前面有8个空格,怎样才能选取这一段并全部向左移动4个空格? if (T->isoper() && T->leftchild && T->leftchild->isoper () && T->compare (T->leftchild)>0) { strcat...
比如有下面这段代码,每行前面有8个空格,怎样才能选取这一段并全部向左移动4个空格?
if (T->isoper() && T->leftchild && T->leftchild->isoper () && T->compare (T->leftchild)>0)
{
strcat (strExprOutput, "(");
WriteInOrder (T->leftchild);
strcat (strExprOutput, ")");
}
else
WriteInOrder (T->leftchild);
char szNode [12] ;
if(T->isnum ())
sprintf (szNode,"%d",T->num) ;
else if (T->isvar () || T->isoper ())
sprintf (szNode,"%c",T->isvar ()?T->var:T->oper) ;
strcat (strExprOutput,szNode) ;
if (T->isoper() && T->rightchild && T->rightchild->isoper () && T->compare (T->rightchild) > 0)
{
strcat (strExprOutput, "(");
WriteInOrder (T->rightchild);
strcat (strExprOutput, "(");
}
else
WriteInOrder (T->rightchild);
if (T->isoper() && T->leftchild && T->leftchild->isoper () && T->compare (T->leftchild)>0)
{
strcat (strExprOutput, "(");
WriteInOrder (T->leftchild);
strcat (strExprOutput, ")");
}
else
WriteInOrder (T->leftchild);
char szNode [12] ;
if(T->isnum ())
sprintf (szNode,"%d",T->num) ;
else if (T->isvar () || T->isoper ())
sprintf (szNode,"%c",T->isvar ()?T->var:T->oper) ;
strcat (strExprOutput,szNode) ;
if (T->isoper() && T->rightchild && T->rightchild->isoper () && T->compare (T->rightchild) > 0)
{
strcat (strExprOutput, "(");
WriteInOrder (T->rightchild);
strcat (strExprOutput, "(");
}
else
WriteInOrder (T->rightchild);
|
v_ap ->选中这一段为visual mode 然后
shift right (4) |v_>|
< shift left (4) |v_
shift right (4) |v_>|
< shift left (4) |v_