vim 问题:Tab 代码块 [英] vim question: tabbing a block of code

查看:36
本文介绍了vim 问题:Tab 代码块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从右到左、从上到下对代码块进行 Tab 键?

How do you tab a block of code, to the right to the left, up and down?

推荐答案

我最喜欢的方式是选择你的代码块(通常使用 [V]isual line mode),然后按 > 或 <.

My favorite way is to select your block of code (with [V]isual line mode normally), then press > or <.

如果您想多次使用 Tab,请按 2> 或 3> 来重复.

If you want to tab more than once, 2> or 3> to repeat it.

如果您没有足够的标签(或标签太多),请输入gv"重新选择您的选择并重试.

If you didn't tab enough (or tabbed too much) then type "gv" to reselect your selection and try again.

要移动一个代码块,用[V]isual line模式选择它,然后按d".这就是剪切"操作.

To move a block of code, select it with [V]isual line mode and then press "d". This is the "Cut" operation.

然后将光标移动到您想要它去的地方,然后按p".这是粘贴"操作.

Then move your cursor to the place you want it to go, and press "p". This is the "Paste" operation.

您也可以尝试自动切换代码块,方法是使用 [V]isual line 模式选择它,然后按=".

You can also try auto-tabbing a block of code by selecting it with [V]isual line mode, and pressing "=".

这篇关于vim 问题:Tab 代码块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆