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 146 remaining solutions by signing in and submitting your own entry
#147 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

147 active golfers, 416 entries

Leaderboard (lowest score wins):
24
#31 - Tim Chase / @gumnos

01/09/2011 at 03:23AM

24
#32 - Federico Galassi / @federicogalassi

01/31/2011 at 12:09AM

24
#33 - Andrey Ivanov / @Bytamine

08/15/2011 at 01:25PM

24
#34 - Albin Olsson / @sentenser

01/16/2012 at 12:01AM

24
#35 - Hubba / @HubbaBubbaFett

12/25/2012 at 09:41PM

24
#36 - Yann Moisan / @YannMoisan

01/24/2013 at 10:33PM

24
#37 - Tyler / @tylerbindon

04/01/2013 at 06:00AM

24
#38 - Denis Kaluznyy / @Spy_Denis

08/17/2017 at 03:44PM

25
#39 - Will Gray / @graywh

01/01/2011 at 12:38AM

25
#40 - Vincent Isambart / @vincentisambart

01/01/2011 at 05:54AM

25
#41 - Prody / @Prody225

01/01/2011 at 04:43PM

25
#42 - Gael / @darkael2

01/09/2011 at 01:23PM

25
#43 - Pete Johns / @johnsyweb

01/15/2011 at 03:09AM

25
#44 - dschobel / @dschobel

02/20/2011 at 12:33AM

25
#45 - 無ん垢の叫び / @john_ababa

02/23/2012 at 02:15PM

26
#46 - uuu / @uu59

12/30/2010 at 01:33AM

26
#47 - Josh Weinberg / @jcweinberg

12/30/2010 at 02:03AM

26
#48 - Behnam Esfahbod / @zwnj

12/30/2010 at 11:34AM

26
#49 - Aaron Bull Schaefer / @elasticdog

12/30/2010 at 05:34PM

26
#50 - milkypostman / @milkypostman

12/31/2010 at 02:31PM

26
#51 - Martin Hauser / @grummel

01/01/2011 at 05:02PM

26
#52 - Fer Enaf / @0x00C0FFEE

01/02/2011 at 08:36AM

26
#53 - ls lahrs / @lslah

01/04/2011 at 07:52PM

26
#54 - Victor Vaile / @victorv4_

01/05/2011 at 09:08AM

26
#55 - Sailesh Mittal / @saileshmittal

01/14/2011 at 06:08PM

26
#56 - Jim Infield / @jinfield

07/21/2011 at 03:04PM

26
#57 - Christopher Brew / @Seph1rothVII

01/31/2012 at 01:44AM

26
#58 - Alex Hammel / @AlexJHammel

12/24/2012 at 05:53PM

26
#59 - James / @Dronak

09/05/2013 at 05:21PM

26
#60 - brett / @brettyukich

09/29/2013 at 07:35PM