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

Reformat some Python

Fix some very bizarrely laid-out code.

Start file
def fed(j):
    n = sum([1000000000,
              200000000,
               30000000,
                4000000,
                 500000,
                  60000,
                   7000,
                    800,
                     90,
                     j])
    print('abc'+str(n)+'def')
End file
def fed(j):
    n = 1234567890 + j
    print('abc%ddef' % n)

View Diff

2,12c2,3
<     n = sum([1000000000,
<               200000000,
<                30000000,
<                 4000000,
<                  500000,
<                   60000,
<                    7000,
<                     800,
<                      90,
<                      j])
<     print('abc'+str(n)+'def')
---
>     n = 1234567890 + j
>     print('abc%ddef' % n)

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 161 remaining solutions by signing in and submitting your own entry
#162 Simon Brown / caelyxsec - Score: 53 - 12/29/10 @ 06:43
jfs5x10J:s/00*, //g<CR>fji0 + <Esc>llDjF'cf'%d<Esc>f'a % n<Esc>ZZ

0 comments


#163 Jason Wolf / zephyr_wolf - Score: 53 - 11/08/12 @ 18:42
j10J:s/00\+\|, \|])//g<CR>fsdf[fji + <Esc>jci'<BS><Del>%d<C-O>f) % n<Esc>ZZ

0 comments


#164 Alex B. / SIGKILL - Score: 54 - 12/29/10 @ 13:48
/s<CR>d/)/e<CR>A1234567890 + j<Down><Esc>ci'<Del><BS>%d<Esc>A<Left> % n<Esc>ZZ

0 comments


#165 Marian Schubert / MarianSchubert - Score: 54 - 12/29/10 @ 13:58
/s<CR>c/)<CR>1234567890 + j<Del><Esc>jF'ct'%d<Del><Esc>wa % n<Esc>w:<BS>ZZ

0 comments


#166 Remigijus (ReekenX) / reekenx - Score: 54 - 12/29/10 @ 16:08
<Down>V13jCn = 1234567890 + j<CR>print('abc%ddef' % n)<Esc>ZZ

0 comments


#167 Bernerd Schaefer / bjschaefer - Score: 55 - 12/29/10 @ 09:52
jfsdf[qqf0DJxq7@qf,C +<Esc>Jf]DjF'cf'%d<Esc>f'a % d<BS>n<Esc>:wq<CR>

0 comments


#168 Lasse Immonen / turtleman10 - Score: 55 - 12/29/10 @ 14:27
3G9ddeeelveeeeedi%d<Esc>eei % n<Esc>kvbbbda1234567890 + j<Esc>ZZ

0 comments


#169 manlon / manlon - Score: 56 - 12/29/10 @ 18:12
/s<CR>DA1234567890 + j<Esc>jVjjjjjjjjd2f'df'i%d<Esc>f)i % n<Esc>:wq<CR>

0 comments


#170 Esteban Ordano / eordano - Score: 57 - 04/07/11 @ 04:02
/s<CR><Esc>d/1<CR>q1ld/ \d<CR>xq7@1JhR + j<Esc>lx/c<CR><Esc>Rc%ddef' % n)<Esc>ld$:wq<CR>

0 comments


#171 Abhishek Mukherjee / abhishekmukherg - Score: 59 - 12/29/10 @ 16:32
/s<CR>df[lqqDJxlq@q@@@@@@@@@@@@lC +<Esc>JllDjF'cf'%d<Esc>f'a % n<Esc>ZZ

0 comments


#172 Bjørn Einar Bjartnes / bjartnes - Score: 59 - 01/27/12 @ 12:35
jfsdwxxqalDJxq8@ai0 + <Esc>llDjdbdbdbhxxxhxxi%f<BS>d<Esc>llllli % n<Esc>ZZ

0 comments


#173 lionel young / lionelyoung - Score: 60 - 12/29/10 @ 07:05
:%s/0//g<CR>2gg10J:s/, //g<CR>2wdf[f]d$i0 + <Esc>jF'cf'%d<Esc>$i % n<Esc>ZZ

0 comments


#174 Andrey A. Ugolnik / andreyugolnik - Score: 60 - 01/19/11 @ 18:51
jdGon = 1234567890 + j<CR>    print('abc%ddef' % n)<Esc>Vk<I    <Esc>ZZ

0 comments


#175 Charlene Tshos / charlymul - Score: 61 - 06/17/13 @ 08:08
j10J:2s/[0|,}<BS>]//g<CR>fs5xqqlxq7@qa0 +<Esc>f]2xj7hdt'xi%d<Esc>f'a % n<Esc>ZZ

0 comments


#176 Sid Kasivajhula / CountVajhula - Score: 62 - 12/29/10 @ 07:39
jfsdf[lqaDJxlDJxlq@a@a@aJhxa+ <Esc>llD/;<BS>'<CR>ncf'%d<Esc>na % n<Esc>:wq<CR>

0 comments


#177 Michael Lustfield / Profarius - Score: 63 - 12/29/10 @ 06:25
<Down>20ddo    n = 1234567890 + j<CR>    print('abc%ddef' % n)<Esc>:x<CR>

0 comments


#178 Paul Tarjan / ptarjan - Score: 63 - 12/29/10 @ 11:48
VGdidef fed(j):<CR><Tab>n = 1234567890 + j<CR>print('abc%ddef' % n)<Esc>ZZ

0 comments


#179 Jan B. / bracki - Score: 64 - 12/29/10 @ 09:13
GddggpjdGf+xdw5x<Left>cw%d<Esc>f'i<Right> % n<Esc>O<Esc>i<Tab>n = 1234567890 + j<Esc>:x<CR>

0 comments


#180 Geoffrey Bachelet / ubermuda - Score: 65 - 12/29/10 @ 08:57
<Down>V9<Down>J:%s/00\+, //g<CR>fsdf[ws +<Esc>w<Right>d$<Esc><Down>F'cf'%d<Esc>wa % n<Esc>:wq<CR>

0 comments


#181 Arania Jain / AraniaJain - Score: 65 - 12/29/10 @ 09:30
<Down>dddddddddddddddddddddd<Insert><End><NL><Home>I<BS><0xce><0xd4><BS><Up><Down><Up><End><Del><Del><Esc>:x<NL>

0 comments


#182 Alexey Komissarouk / alexeymk - Score: 65 - 12/29/10 @ 13:26
/s<CR>R1234567890 + j<Del><Del><Esc><Down>:d9<CR>/c<CR>a%ddef<Right> % n(<Esc>i)<Esc><Right>D<Esc>:wq<CR>

0 comments


#183 smokey42 / smokey42 - Score: 65 - 12/29/10 @ 14:41
on = 123456789<C-><PageUp>0 +j<BS> j<Esc><CR>d10df'nf'df'i%d<End><Left> % n<Esc>ZZ

0 comments


#184 Solomon White / rubysolo - Score: 68 - 12/29/10 @ 17:39
jjVjjjjjjj20<:%s/0*,\n//g<CR>ell2dwElC0 + j<Esc>jbbbb5cw%d<Esc>Ei %n<BS> n<Esc>ZZ

0 comments


#185 Thanassis Tsiodras / ttsiodras - Score: 69 - 01/03/11 @ 18:20
:%s,0,,g<CR>:2<CR>JJJJJJJJJ:.,.s/, //g<CR>fs5xf9a0 + <Esc>llDjF'8xR%d<Esc>f'a % n<Esc>:wq<CR>

0 comments


#186 Rob Howard / damncabbage - Score: 72 - 12/29/10 @ 11:11
/1<CR>qald$Jxq7@aJ<Left>r a+<Esc>:s/[sum()\[\]]*//g<CR>2/'<CR>dtdi%d<Esc>$i & <BS><BS>% n<Esc>:wq<CR>

0 comments


#187 Fraxtil / Fraxtil - Score: 73 - 12/29/10 @ 07:30
:%s/0*,\n *//g<CR>:%s/s.*\[//g<CR>:2s/j.*/0 + j/<CR>:%s/'+.*+'/%d/<CR>/)<CR>i % n<Esc>:x<CR>

0 comments


#188 Dhruva Sagar / dhruvasagar - Score: 73 - 12/29/10 @ 08:30
:%s/0*,\n *//|%s/s.*\[//|2s/k<BS>j.*/0 + j/|%s/'+.*+'/%d/<CR><End>i % n<Esc>:wq<CR>

0 comments


#189 Jonathan Pui / jpui - Score: 74 - 12/29/10 @ 08:11
:%s/0\+,\n\s+//<BS><BS><BS>\+//<CR>fsdf[fji0 + <Esc>lld$jdF'df'a<Esc>i%d<Esc>f'a % n<Esc>:wq<CR>

0 comments


#190 Chris Flynn / flynnguy - Score: 74 - 12/29/10 @ 15:55
jJJJJJJJJ:s/0\+, //g<CR>ww5x$DJa+ <Esc>llDj:s/'+str(n)+'/%d/<CR>$i % n<Esc>:wq<CR>

0 comments


#191 Sushant / sushftw - Score: 75 - 12/29/10 @ 12:51
/s<CR>C1234567890 + j<Esc><Down>d8<Down><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>C%ddef' % n)<Esc>ZZ

0 comments


#192 Ben Dowling / coderholic - Score: 83 - 12/31/10 @ 17:13
:%s/0*,\n *//g<CR>4ld5l<End><Del><Del>i0 + <Down><BS><BS><BS><BS><BS><BS><BS>%d<Del><Del><Del><End><Left> % n<Esc>:x<CR>

0 comments


#193 Gordy F / gordyf - Score: 85 - 12/29/10 @ 06:48
/s<CR>C12354<BS><BS>4567890 + j<Esc><Down>d8<Down><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>C%ddef' % n)<Esc>:wq<CR>

0 comments


#194 Guillaume Bonnoron / gbonnoron - Score: 90 - 12/31/10 @ 11:42
j10ccn = 1234567890+j<BS><BS> + j<Esc>^i<BS><Tab><BS>    <Esc>:s<BS>%s/'+str\(n<BS><BS><BS>(n)+'/%d/<CR>$i % n<Esc>ZZ

0 comments


#195 Mohammad Mithani / mtmithani - Score: 98 - 12/23/13 @ 03:07
<Down>ma<Down><Down><Down><Down><Down><Down><Down><Down><Down>d'a<Up><Right><Right><Right><Right><Right><Right><Right><Right>o<BS>    n = 123456788<BS>9-<BS>0 + j<Down><Left><Left><Left><Left><Left><Left><Left><Left>%ddef<Right> % n<Esc><Right>xxxxxxxxxxxxx<Down><Up><Up><Down><Esc><Esc>:w<CR>:q<CR>

0 comments


#196 Charles Maresh / CMaresh - Score: 104 - 12/29/10 @ 14:58
:%s/0<BS>0{\<BS><BS>\{0<BS>2,\}//g<BS><CR>:%s/,<BS>,\n//<CR>V:s/ \{2,\}//g<CR>>>.fs<C-V>f[x$xxi + <Esc>jf'<C-V>F'c%d<Esc>$i % n<Esc>:wq<CR>

0 comments


#197 Christian Stefanescu / 0_chris - Score: 106 - 12/29/10 @ 06:29
<Down>10dd<Up><End><CR>I<CR><Up>n = 1234567890 <kPlus> j<Esc><Down><Left><Left><Left><Left><Left><Left><Left>5dwi%d<Right><Right><Right><Right> % n<Esc>:wq<CR>

0 comments


#198 theshadowhost / theshadowhost - Score: 106 - 12/29/10 @ 13:32
zojwwwv)khc1<Esc>qayplpuqqaycpuyypuvypqhlDvyp<C-A>qavyp<C-A>q5@a@@@@hhxr8li9<Esc>A + j<Esc>jbbbbveeeelllc%d<Esc>f' a<Esc><Esc>a % n<Esc>:x<CR>

0 comments


#199 nat / natblue55 - Score: 108 - 01/02/11 @ 00:55
<Down>10J:s/,/+/g<CR>wwdw.vfj<Left><Left><Left>xra<C-C><C-C>r_<Right><Left>r+<Left>a<C-R>=<C-R>*<CR> <Esc>A<BS><BS><Esc><Down>r%bb<Left><Left><Left><Left><Left><Left><Left><Right><Right>.i<C-C><C-C>i<C-C><C-C><Right><Right><Right>v<Right><Right><Right><Right><Right><Right><Right><Right>x<Right><Right><Right>a $<BS>% n<Esc><Left><Left><Left><Left><Left><Left><Left><Left>ad<Esc>:wq<CR>

0 comments


#200 Benjaminister / Benjaminister - Score: 110 - 12/29/10 @ 08:10
:%s/\(\d\)0*,\n\s*/\1<CR>:s/s\D*\(\d*\)j.*/\10 + j<CR>j:s/'+.*'def'/<Left><Left><BS><BS><BS><BS><Right>)<Right><Right>%ddef' % n<CR>$a)<Esc>ZZ

0 comments


#201 Andy Chong / andycjw - Score: 112 - 12/30/10 @ 03:34
jlllllllli1234567890 + j<Esc>lvjjjjjjjjjlllduvjjjjjjjjjjkldljhhhhhhhvlllllllll%llllllllllllllxi%d<Esc>)hhli %n<Esc> hi <Esc>:wq<CR>

0 comments


#202 Irfan Ahmad / erfaan - Score: 299 - 12/29/10 @ 14:10
<Down><Down>dddddddddddddddd<Right>i<Del><Del><Up><Left><Left><Left><Left><Left><Left><Left><Left><Left><BS><BS><BS><BS><BS><Right><Del>234567890<Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del> <kPlus><Del><Right><Right><Down><Home><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Left><Del><Del><Del><Del><Del><Del><Del><Del><Del><Del>%d<Right><Right><Right><Right> % n<Esc>:wq<CR>

0 comments


Created by: holizz

202 active golfers, 496 entries

Leaderboard (lowest score wins):
34
#1 - Akira Matsuda / a_matsuda

12/30/2010 at 05:16PM

34
#2 - derp derp / derp__

01/02/2011 at 12:05AM

34
#3 - Ujjwol Lamichhane / Ujjwol

01/06/2011 at 12:33PM

34
#4 - Balkoth / _Balkoth_

01/08/2011 at 05:47PM

34
#5 - Tim Chase / gumnos

01/13/2011 at 03:20AM

34
#6 - Wei Dai / clvv42

01/13/2011 at 03:23AM

34
#7 - h_east (トロッコ6個) / h_east

01/16/2011 at 07:24AM

34
#8 - Oleg Roshupkin / jjjahson

01/21/2011 at 05:34AM

34
#9 - vg / vimgolfer

02/26/2011 at 04:42PM

34
#10 - Justin Love / wondible

06/13/2011 at 01:18PM

34
#11 - Hu Junfeng / junfeng

07/17/2011 at 12:17PM

34
#12 - Andrey Ivanov / Bytamine

08/11/2011 at 11:24AM

34
#13 - Federico Galassi / federicogalassi

08/28/2011 at 01:46AM

34
#14 - p0ckets / p0ckets

10/06/2011 at 11:42PM

34
#15 - You-Siang Lin / yslinnctu

11/29/2011 at 03:25PM

34
#16 - Pei-Lun Lee / ypcatw

01/14/2012 at 05:47AM

34
#17 - Zeh Rizzatti / zehrizzatti

02/08/2012 at 05:19AM

34
#18 - Renat Aksitov / Korvin79

02/09/2012 at 08:55AM

34
#19 - Nolen Royalty / NolenRoyalty

04/21/2012 at 10:22PM

34
#20 - Rod Knowlton / codelahoma

05/27/2012 at 03:51AM

34
#21 - Joe McCall / joem86

07/02/2012 at 09:47PM

34
#22 - Kerson Hsiao / KersonHsiao

07/12/2012 at 07:31AM

34
#23 - Conner McDaniel / connermcd

09/19/2012 at 02:04AM

34
#24 - Urtica dioica / udioica

12/13/2012 at 07:26AM

34
#25 - Hubba / HubbaBubbaFett

12/16/2012 at 12:11PM

34
#26 - Trevor Powell / DoomedBunnies

03/20/2013 at 05:24AM

34
#27 - Marco Hinz / _mhinz_

05/22/2013 at 08:55AM

34
#28 - Petro Тrouq / zulolosi

07/06/2013 at 01:42AM

34
#29 - Daniel Jonsson / DanielJonss

01/21/2014 at 04:43PM

34
#30 - John Braxler / braxler

05/06/2014 at 12:24PM