posts - 403, comments - 310, trackbacks - 0, articles - 7
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

Vim - Formatting the code

Posted on 2007-08-06 21:24 ZelluX 阅读(354) 评论(0)  编辑  收藏 所属分类: Linux
1. The following Vim command will perform a fast code block formatting:
1G=G
We can split it up in simply says:
1G : Go to the first line(you can also use gg)
= : Indent according to the configuration
G : Go to the last line(tell Vim where to end indenting)

2. Another way is to go into visual mode with V and press =  to reindent the chosen lines.

3.
=i{ will reindent everything between { and } excluding the brackets.
other similar choices:
a{ : all the code between { and } including the brackets.
i(, a(, i<, a<, i[, a[


只有注册用户登录后才能发表评论。


网站导航: