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 4d2c9d06eda6262e4e00007a

Assignment Alignment

line up the operators. Use spaces, not tabs.

Start file
# Align these assignments

x = 1
y = true
z = 'you'
foo = 'bar'
long_name = "long variable value"
$p3cial = ch4rs
last = line

# Much better!
End file
# Align these assignments

x         = 1
y         = true
z         = 'you'
foo       = 'bar'
long_name = "long variable value"
$p3cial   = ch4rs
last      = line

# Much better!

View Diff

3,6c3,6
< x = 1
< y = true
< z = 'you'
< foo = 'bar'
---
> x         = 1
> y         = true
> z         = 'you'
> foo       = 'bar'
8,9c8,9
< $p3cial = ch4rs
< last = line
---
> $p3cial   = ch4rs
> last      = line

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 219 remaining solutions by signing in and submitting your own entry
#220 personlink / @personlink - Score: 363 - 04/07/11 @ 08:56
Vjjjjjjjjjjjjjjjjyppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp<Esc>dddxxxxxxxxxxxxxxixxxxxx<Esc>GGVggdi# Align these assignments<CR><CR>x         = 1<CR>y         = true<CR>z         = 'you'<CR>foo       = 'bar'<CR>long_name = "long variable value"<CR>$p3cial   = ch4rs<CR>last      = line<CR><CR># Much better!<Esc>:wq<CR>

0 comments


Created by: @khamer

220 active golfers, 883 entries

Leaderboard (lowest score wins):
18
#1 - Wei Dai / @clvv42

01/11/2011 at 09:24PM

18
#2 - Pete Johns / @johnsyweb

01/12/2011 at 01:01AM

18
#3 - derp derp / @derp__

01/12/2011 at 11:36AM

18
#4 - Martin Sander / @0x89

01/14/2011 at 09:35PM

18
#5 - Karol Samborski / @edv1989

01/15/2011 at 10:59PM

18
#6 - AD / @golferTest101

01/16/2011 at 07:18PM

18
#7 - ls lahrs / @lslah

01/17/2011 at 04:55PM

18
#8 - SirVer / @SirVerII

01/22/2011 at 10:09PM

18
#9 - iCross / @iCrossOfficial

02/01/2011 at 01:24PM

18
#10 - Ujjwol Lamichhane / @Ujjwol

02/03/2011 at 03:22AM

18
#11 - Tim Chase / @gumnos

02/03/2011 at 12:27PM

18
#12 - Andrew Dorman / @andydorman

02/18/2011 at 09:40PM

18
#13 - Joost / @vlabakje

02/20/2011 at 12:50PM

18
#14 - Pavlo Klets / @p01nt

02/25/2011 at 10:27AM

18
#15 - vg / @vimgolfer

02/27/2011 at 10:23PM

18
#16 - Jon Olick / @JonOlick

03/25/2011 at 04:49PM

18
#17 - Emile Swarts / @EmileSwarts

06/09/2011 at 08:17PM

18
#18 - Junfeng / @junfeng

08/01/2011 at 10:40AM

18
#19 - Justin Love / @wondible

09/02/2011 at 01:26PM

18
#20 - William Dunand / @wdunand

11/08/2011 at 08:44AM

18
#21 - You-Siang Lin / @yslinnctu

12/01/2011 at 03:16AM

18
#22 - Abdel Said / @abdelsaid

01/15/2012 at 07:36PM

18
#23 - Vasil Sakarov / @vsakarov

01/16/2012 at 12:43AM

18
#24 - Dan Hart / @DHJHart

02/07/2012 at 05:14PM

18
#25 - Renat Aksitov / @Korvin79

03/03/2012 at 06:11PM

18
#26 - Rod Knowlton / @codelahoma

05/26/2012 at 01:17AM

18
#27 - Urtica dioica / @udioica

05/29/2012 at 09:44PM

18
#28 - Kerson Hsiao / @KersonHsiao

08/01/2012 at 08:46AM

18
#29 - Joel Elkins / @dice_tea

03/05/2013 at 05:53AM

18
#30 - Trevor Powell / @DoomedBunnies

03/25/2013 at 05:53AM