vim高手?请看vimgolf.com

vimgolf是一个在线比试vim技巧的网站。来看看题目有多变态,比如这一题,原文是

1
2
3
4
5
6
7
8
9
10
11
this line doesn’t have indentation
this line is indented with two spaces
this one has four
this other one has two
this one is indented with two spaces
this line has a four spaces indentation
this line needs six spaces
this line needs six spaces too
this line is back to four spaces
this line is finally indented with two spaces
this final line is not indented

要求按每一行中的指定的空格数缩进,也就是格式化成这样:

1
2
3
4
5
6
7
8
9
10
11
this line doesn’t have indentation
  this line is indented with two spaces
    this one has four
  this other one has two
  this one is indented with two spaces
    this line has a four spaces indentation
      this line needs six spaces
      this line needs six spaces too
    this line is back to four spaces
  this line is finally indented with two spaces
this final line is not indented

目前已经有三位朋友提交了解答,按键最少的一位只用了25次按键就搞定了。
如果你觉得你是vim高手,去挑战一下吧。

注:要提交结果,好象先要用twitter登录,得到一个数字ID,再用ruby装一个软件。我一直没装上,不知道是什么原因。



发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

注意: 评论者允许使用'@user空格'的方式将自己的评论通知另外评论者。例如, ABC是本文的评论者之一,则使用'@ABC '(不包括单引号)将会自动将您的评论发送给ABC。使用'@all ',将会将评论发送给之前所有其它评论者。请务必注意user必须和评论者名相匹配(大小写一致)。