Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 4d1bdde3b2c3e0646800007f

Indentation

Indent each line according to the right number of spaces it needs.

Start file
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
End file
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

View Diff

2,10c2,10
< 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 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

Solutions

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 143 remaining solutions by signing in and submitting your own entry
#144 Andy Brett / @andrewpbrett - Score: 170 - 12/30/10 @ 08:21
j  <Left><Left>i  <Down><Left><Left>    <Down><Left><Left><Left><Left>  <Down><Left><Left>  <Down><Left><Left>    <Down><Down><Up><Left><Left><Left><Left>      <Down><Left><Left><Left><Left><Left><Left>      <Down><Left><Left><Left><Left><Left><Left><Left>    <Down><Left><Left><Left><Left>  <Esc>:wq<CR>

0 comments


Created by: @remi

144 active golfers, 405 entries

Leaderboard (lowest score wins):
27
#61 - 藤田祥 / Sho Fujita / @fujisho

12/31/2010 at 12:29PM

27
#62 - AD / @golferTest101

01/01/2011 at 04:48PM

27
#63 - Philipp / @klmann232

01/10/2011 at 12:29AM

27
#64 - Wesley Wong / @wesleymwwong

01/30/2011 at 10:54AM

27
#65 - Jyun-Fan Tsai / @fakecolor

02/15/2012 at 09:56AM

27
#66 - Kerson Hsiao / @KersonHsiao

05/07/2012 at 10:37AM

27
#67 - RobertT / @techrt2050

07/14/2013 at 08:57AM

27
#68 - Benjamin Williams / @benjaminjosephw

01/11/2014 at 09:39PM

27
#69 - Joonas Pihlajamaa / @jokkebk

02/21/2014 at 11:27AM

27
#70 - Jon Krause / @jkrause314

12/17/2015 at 09:32PM

28
#71 - seth cousins / @sethcousins

12/30/2010 at 03:10PM

28
#72 - Mikel Ward / @mikelward

12/31/2010 at 01:52PM

28
#73 - Jesús Espino / @jespinog

09/05/2011 at 10:56PM

28
#74 - Xavier Nayrac / @lkdjiin

12/30/2011 at 01:52PM

28
#75 - cj / @cj01101

02/03/2014 at 11:48PM

29
#76 - Brad Grzesiak / @listrophy

12/30/2010 at 01:30AM

29
#77 - Isaiah Damron / @Aenidye

12/30/2010 at 01:36AM

29
#78 - greg / @kongo2002

12/31/2010 at 12:26AM

29
#79 - razvan dimescu / @razvandimescu

12/31/2010 at 08:34AM

29
#80 - Leonard Chin / @lchin

12/31/2010 at 10:17AM

29
#81 - emmanuel delgado / @chischaschos

01/01/2011 at 07:04AM

29
#82 - Arto Vuori / @dhpe

09/01/2012 at 07:43PM

29
#83 - George Angelopoulos / @g_usermod

08/05/2016 at 02:24PM

30
#84 - Roland Crosby / @roooooland

12/30/2010 at 08:19AM

30
#85 - Sam Saffron / @samsaffron

12/30/2010 at 12:35PM

30
#86 - Fred Nias / @frednias

12/30/2010 at 01:01PM

30
#87 - David Shaw / @shawthings

12/30/2010 at 10:57PM

30
#88 - Johannes Martinsson / @moxiba

12/30/2010 at 11:28PM

30
#89 - Sam Nardoni / @samnardoni

12/31/2010 at 12:05AM

30
#90 - Juan C. Muller / @juancmuller

12/31/2010 at 03:39AM