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):
30
#91 - Joshua Flanagan / @jflanagan

12/31/2010 at 11:35PM

30
#92 - Kyle Willmon / @kylewillmon

01/01/2011 at 12:36AM

30
#93 - Marcin Ciunelis / @martinciu

01/01/2011 at 06:42PM

30
#94 - Stuart Gale / @bishboria

01/02/2011 at 07:36PM

30
#95 - Adam Pohorecki / @apohorecki

01/04/2011 at 01:24PM

30
#96 - drio / @drio

01/07/2011 at 01:04PM

30
#97 - fuck you / @jerkassholeface

01/15/2011 at 12:47AM

30
#98 - Andrey A. Ugolnik / @andreyugolnik

01/19/2011 at 10:13PM

30
#99 - Oleg Roshupkin / @jjjahson

01/21/2011 at 09:39AM

30
#100 - mightyfoo / @mightyfoo

05/26/2011 at 02:37PM

30
#101 - (Emile (Swarts)) / @EmileSwarts

05/30/2011 at 07:56PM

30
#102 - Lauri Tirkkonen / @lotheac

07/01/2011 at 10:06PM

30
#103 - jasper110 / @jasper110

09/22/2011 at 09:42AM

30
#104 - William Dunand / @wdunand

12/01/2011 at 03:41AM

30
#105 - Camilla Krag Jensen / @naxoc

07/29/2012 at 12:16PM

30
#106 - Gregor Schmidt / @schmidtwisser

10/01/2012 at 07:09PM

30
#107 - Ram Tamtam / @ramtamtamtam

07/02/2014 at 01:28PM

31
#108 - Ricardo Sisnett / @mrjackinc

01/03/2011 at 02:28AM

31
#109 - Thomas Schönwälder / @Masei1988

01/11/2011 at 11:24PM

31
#110 - Francisco Dibar / @frandibar

01/13/2011 at 03:55AM

31
#111 - Oliver Christ / @0liverChrist

02/27/2015 at 03:53PM

32
#112 - VitalyBerov / @VitalyBerov

12/23/2012 at 01:17AM

32
#113 - mnx / @mnxx

06/13/2014 at 09:44AM

32
#114 - SplinterPie / @splinter_pie

05/04/2018 at 11:18AM

33
#115 - Asmund / @herrasbe

12/31/2010 at 08:51AM

33
#116 - aimee / @sermoa

01/09/2011 at 04:03PM

33
#117 - eholic / @eholic

04/04/2011 at 12:30PM

33
#118 - Charlie Tanksley / @charlietanksley

10/13/2011 at 04:13PM

33
#119 - Stefan Schmidt / @stafue

12/06/2013 at 04:42PM

34
#120 - Jordi Romero / @jordiromero

12/31/2010 at 03:59PM