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

196 active golfers, 695 entries

Leaderboard (lowest score wins):
18
#31 - Marco Hinz / @_mhinz_

05/23/2013 at 08:24AM

18
#32 - Petro Тrouq / @zulolosi

07/04/2013 at 09:34PM

18
#33 - Bradd Szonye / @bszonye

07/15/2013 at 03:33AM

18
#34 - Joonas Pihlajamaa / @jokkebk

02/19/2014 at 09:08PM

18
#35 - John Braxler / @braxler

04/23/2014 at 05:54PM

18
#36 - kimber gonzalez / @kimberlycreates

01/22/2015 at 03:49PM

18
#37 - pftb12345 / @pftb12345

04/12/2015 at 01:57PM

18
#38 - Jon Krause / @jkrause314

12/26/2015 at 08:31PM

18
#39 - Dimitar Dimitrov / @kurkale6ka

04/15/2016 at 03:14PM

18
#40 - Will / @obiwan__k3n00bi

09/03/2016 at 08:03AM

18
#41 - Angel Chiang / @malakin

03/06/2017 at 08:39PM

18
#42 - Zhihong Liu / @pieapple03

03/25/2017 at 04:29AM

18
#43 - Daniel / @Daniel00288663

04/03/2017 at 09:02AM

18
#44 - Gurukandhamoorthi / @Gurukandhamoor1

07/19/2017 at 05:43PM

18
#45 - Turkey Man / @lvturkeyman

11/25/2017 at 08:27AM

18
#46 - BarbaJol / @drpproteus

01/09/2018 at 05:43PM

18
#47 - DHM / @DHM29978992

04/30/2018 at 06:28PM

18
#48 - alekfed / @alek_fed

04/20/2019 at 02:33PM

18
#49 - Daniel Steinberg / @dstein64

05/02/2019 at 07:10PM

19
#50 - Balkoth / @_Balkoth_

01/12/2011 at 12:28AM

19
#51 - Oleg Roshupkin / @jjjahson

01/14/2011 at 06:20AM

19
#52 - Dragan Cvetinovic / @kawkafi

05/02/2011 at 02:47PM

19
#53 - Pei-Lun Lee / @ypcatw

01/08/2012 at 04:41AM

19
#54 - Arton0306 / @Arton0306

01/11/2012 at 06:45AM

19
#55 - Chris Brown / @engineercyb

09/12/2012 at 12:59AM

19
#56 - US Dollar Price / @USDollarPrice

11/06/2013 at 07:56AM

19
#57 - João Paiva / @jgpaiva

02/10/2014 at 08:13PM

19
#58 - Johan Berg / @_berg85

02/14/2014 at 10:23AM

19
#59 - paulfariello ✏️ / @paulfariello

12/12/2014 at 03:14PM

19
#60 - mark0829 / @mark0829

03/19/2015 at 01:00AM