Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Leaderboard, Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 4d1c27940e3d7832db000010

Prime Numbers

List the first 100 prime numbers.

Start file
Prime Numbers
End file
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97
101
103
107
109
113
127
131
137
139
149
151
157
163
167
173
179
181
191
193
197
199
211
223
227
229
233
239
241
251
257
263
269
271
277
281
283
293
307
311
313
317
331
337
347
349
353
359
367
373
379
383
389
397
401
409
419
421
431
433
439
443
449
457
461
463
467
479
487
491
499
503
509
521
523
541

View Diff

1c1,100
< Prime Numbers
---
> 2
> 3
> 5
> 7
> 11
> 13
> 17
> 19
> 23
> 29
> 31
> 37
> 41
> 43
> 47
> 53
> 59
> 61
> 67
> 71
> 73
> 79
> 83
> 89
> 97
> 101
> 103
> 107
> 109
> 113
> 127
> 131
> 137
> 139
> 149
> 151
> 157
> 163
> 167
> 173
> 179
> 181
> 191
> 193
> 197
> 199
> 211
> 223
> 227
> 229
> 233
> 239
> 241
> 251
> 257
> 263
> 269
> 271
> 277
> 281
> 283
> 293
> 307
> 311
> 313
> 317
> 331
> 337
> 347
> 349
> 353
> 359
> 367
> 373
> 379
> 383
> 389
> 397
> 401
> 409
> 419
> 421
> 431
> 433
> 439
> 443
> 449
> 457
> 461
> 463
> 467
> 479
> 487
> 491
> 499
> 503
> 509
> 521
> 523
> 541

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 53 remaining solutions by signing in and submitting your own entry
#54 mightyfoo / @mightyfoo - Score: 147 - 05/26/11 @ 16:10
:fu P(x)<CR>for i in range(2,a:x)<CR>if !(a:x%i)<CR>return a:x==i<CR>en<CR>endfo<CR>endf<CR>:for i in filter(range(2,541),'P(v:val)')<CR>cal append(line('$'),i)<CR>endfo<CR>ddZZ

0 comments

#55 h_east (DDD ready) / @h_east - Score: 192 - 01/29/11 @ 13:12
:let a=[]|for i in range(542)|call add(a, 0)|endfo|for i in range(2,270)|let x=i*2|wh x<542|let a[x]=1|let x+=i|endw|endfo|for i in range(2,541)|if !a[i]|call append(line("$"),i)|en|endfo<CR>ddZZ

0 comments

#56 Hung Huu Hoang / @hungh3 - Score: 252 - 01/02/11 @ 06:55
:function P(x)<CR>for i in range(2,a:x/2)<CR>ifa:x<BS><BS><BS> a:x%i==0<CR>return 0<CR>endif<CR>endfor<CR>return 1<CR>endfunction<CR>:function L()<CR>let s= <BS><BS>="2<C-V><CR>3"<CR>for i in range(4,541)<CR>if P(i)==1<CR>let s=s."<C-V><CR>".i<CR>endif<CR>endfor<CR>return s<CR>endfunction<CR>:call setline(".",L())<CR>:%s/<C-V><CR>/<C-V><CR>/g<CR>:wq<CR>

0 comments

#57 drio / @drio - Score: 278 - 01/09/11 @ 17:24
Difu! X()<CR>  let _=[]<CR>  for i in range(2,541)<CR>    if i%2!=0&&i%3!=0&&i%5!=0&&i%7!=0&&i%11!=0&&i%13!=0&&i%17!=0&&i%19!=0&&i%19!=0&&i%23!=0&&i%29!=0<CR>    cal add(_,i)<CR>  endif<CR>  endfo<CR>  retu _<CR>endf<Esc>:w<CR><Esc>:sou<Tab> %<CR>vGGdd<Esc><Esc>:1<CR><Esc>vjjjjjjjjjjd<Esc>0D<Esc>:put_<BS>=X()<CR><Esc>:1<CR><Esc>i2<CR>3<CR>5<CR>7<CR>11<CR>13<CR>17<CR>19<CR>23<CR>29<Esc>:x<CR>

0 comments

#58 Ron Gejman / @rongejman - Score: 374 - 12/30/10 @ 07:08
C2<CR>3<CR>5<CR>7<CR>11<CR>13<CR>17<CR>19<CR>23<CR>29<CR>31<CR>37<CR>41<CR>43<CR>47<CR>53<CR>59<CR>61<CR>67<CR>71<CR>73<CR>79<CR>83<CR>89<CR>97<CR>101<CR>103<CR>107<CR>109<CR>113<CR>127<CR>131<CR>137<CR>139<CR>149<CR>151<CR>157<CR>163<CR>167<CR>173<CR>179<CR>181<CR>191<CR>193<CR>197<CR>199<CR>211<CR>223<CR>227<CR>229<CR>233<CR>239<CR>241<CR>251<CR>257<CR>263<CR>269<CR>271<CR>277<CR>281<CR>283<CR>293<CR>307<CR>311<CR>313<CR>317<CR>331<CR>337<CR>347<CR>349<CR>353<CR>359<CR>367<CR>373<CR>379<CR>383<CR>389<CR>397<CR>401<CR>409<CR>419<CR>421<CR>431<CR>433<CR>439<CR>443<CR>449<CR>457<CR>461<CR>463<CR>467<CR>479<CR>487<CR>491<CR>499<CR>503<CR>509<CR>521<CR>523<CR>541<Esc>ZZ

0 comments

#59 Behnam Esfahbod / @zwnj - Score: 374 - 12/30/10 @ 10:25
C2<CR>3<CR>5<CR>7<CR>11<CR>13<CR>17<CR>19<CR>23<CR>29<CR>31<CR>37<CR>41<CR>43<CR>47<CR>53<CR>59<CR>61<CR>67<CR>71<CR>73<CR>79<CR>83<CR>89<CR>97<CR>101<CR>103<CR>107<CR>109<CR>113<CR>127<CR>131<CR>137<CR>139<CR>149<CR>151<CR>157<CR>163<CR>167<CR>173<CR>179<CR>181<CR>191<CR>193<CR>197<CR>199<CR>211<CR>223<CR>227<CR>229<CR>233<CR>239<CR>241<CR>251<CR>257<CR>263<CR>269<CR>271<CR>277<CR>281<CR>283<CR>293<CR>307<CR>311<CR>313<CR>317<CR>331<CR>337<CR>347<CR>349<CR>353<CR>359<CR>367<CR>373<CR>379<CR>383<CR>389<CR>397<CR>401<CR>409<CR>419<CR>421<CR>431<CR>433<CR>439<CR>443<CR>449<CR>457<CR>461<CR>463<CR>467<CR>479<CR>487<CR>491<CR>499<CR>503<CR>509<CR>521<CR>523<CR>541<Esc>ZZ

0 comments

#60 Alain Gilbert / @alain_gilbert - Score: 374 - 12/31/10 @ 20:55
C2<CR>3<CR>5<CR>7<CR>11<CR>13<CR>17<CR>19<CR>23<CR>29<CR>31<CR>37<CR>41<CR>43<CR>47<CR>53<CR>59<CR>61<CR>67<CR>71<CR>73<CR>79<CR>83<CR>89<CR>97<CR>101<CR>103<CR>107<CR>109<CR>113<CR>127<CR>131<CR>137<CR>139<CR>149<CR>151<CR>157<CR>163<CR>167<CR>173<CR>179<CR>181<CR>191<CR>193<CR>197<CR>199<CR>211<CR>223<CR>227<CR>229<CR>233<CR>239<CR>241<CR>251<CR>257<CR>263<CR>269<CR>271<CR>277<CR>281<CR>283<CR>293<CR>307<CR>311<CR>313<CR>317<CR>331<CR>337<CR>347<CR>349<CR>353<CR>359<CR>367<CR>373<CR>379<CR>383<CR>389<CR>397<CR>401<CR>409<CR>419<CR>421<CR>431<CR>433<CR>439<CR>443<CR>449<CR>457<CR>461<CR>463<CR>467<CR>479<CR>487<CR>491<CR>499<CR>503<CR>509<CR>521<CR>523<CR>541<Esc>ZZ

0 comments

#61 Joel Taylor / @joelteon_ - Score: 374 - 01/01/11 @ 04:53
C2<CR>3<CR>5<CR>7<CR>11<CR>13<CR>17<CR>19<CR>23<CR>29<CR>31<CR>37<CR>41<CR>43<CR>47<CR>53<CR>59<CR>61<CR>67<CR>71<CR>73<CR>79<CR>83<CR>89<CR>97<CR>101<CR>103<CR>107<CR>109<CR>113<CR>127<CR>131<CR>137<CR>139<CR>149<CR>151<CR>157<CR>163<CR>167<CR>173<CR>179<CR>181<CR>191<CR>193<CR>197<CR>199<CR>211<CR>223<CR>227<CR>229<CR>233<CR>239<CR>241<CR>251<CR>257<CR>263<CR>269<CR>271<CR>277<CR>281<CR>283<CR>293<CR>307<CR>311<CR>313<CR>317<CR>331<CR>337<CR>347<CR>349<CR>353<CR>359<CR>367<CR>373<CR>379<CR>383<CR>389<CR>397<CR>401<CR>409<CR>419<CR>421<CR>431<CR>433<CR>439<CR>443<CR>449<CR>457<CR>461<CR>463<CR>467<CR>479<CR>487<CR>491<CR>499<CR>503<CR>509<CR>521<CR>523<CR>541<Esc>ZZ

0 comments

#62 Stephan Weller / @stephan_weller - Score: 374 - 01/06/11 @ 10:45
C2<CR>3<CR>5<CR>7<CR>11<CR>13<CR>17<CR>19<CR>23<CR>29<CR>31<CR>37<CR>41<CR>43<CR>47<CR>53<CR>59<CR>61<CR>67<CR>71<CR>73<CR>79<CR>83<CR>89<CR>97<CR>101<CR>103<CR>107<CR>109<CR>113<CR>127<CR>131<CR>137<CR>139<CR>149<CR>151<CR>157<CR>163<CR>167<CR>173<CR>179<CR>181<CR>191<CR>193<CR>197<CR>199<CR>211<CR>223<CR>227<CR>229<CR>233<CR>239<CR>241<CR>251<CR>257<CR>263<CR>269<CR>271<CR>277<CR>281<CR>283<CR>293<CR>307<CR>311<CR>313<CR>317<CR>331<CR>337<CR>347<CR>349<CR>353<CR>359<CR>367<CR>373<CR>379<CR>383<CR>389<CR>397<CR>401<CR>409<CR>419<CR>421<CR>431<CR>433<CR>439<CR>443<CR>449<CR>457<CR>461<CR>463<CR>467<CR>479<CR>487<CR>491<CR>499<CR>503<CR>509<CR>521<CR>523<CR>541<Esc>ZZ

0 comments

#63 無ん垢の叫び / @john_ababa - Score: 374 - 02/23/12 @ 15:49
C2<CR>3<CR>5<CR>7<CR>11<CR>13<CR>17<CR>19<CR>23<CR>29<CR>31<CR>37<CR>41<CR>43<CR>47<CR>53<CR>59<CR>61<CR>67<CR>71<CR>73<CR>79<CR>83<CR>89<CR>97<CR>101<CR>103<CR>107<CR>109<CR>113<CR>127<CR>131<CR>137<CR>139<CR>149<CR>151<CR>157<CR>163<CR>167<CR>173<CR>179<CR>181<CR>191<CR>193<CR>197<CR>199<CR>211<CR>223<CR>227<CR>229<CR>233<CR>239<CR>241<CR>251<CR>257<CR>263<CR>269<CR>271<CR>277<CR>281<CR>283<CR>293<CR>307<CR>311<CR>313<CR>317<CR>331<CR>337<CR>347<CR>349<CR>353<CR>359<CR>367<CR>373<CR>379<CR>383<CR>389<CR>397<CR>401<CR>409<CR>419<CR>421<CR>431<CR>433<CR>439<CR>443<CR>449<CR>457<CR>461<CR>463<CR>467<CR>479<CR>487<CR>491<CR>499<CR>503<CR>509<CR>521<CR>523<CR>541<Esc>ZZ

0 comments

#64 vimja / @vimja666 - Score: 376 - 03/16/12 @ 03:03
Di2<CR>3<CR>5<CR>7<CR>11<CR>13<CR>17<CR>19<CR>23<CR>29<CR>31<CR>37<CR>41<CR>43<CR>47<CR>53<CR>59<CR>61<CR>67<CR>71<CR>73<CR>79<CR>83<CR>89<CR>97<CR>101<CR>103<CR>107<CR>109<CR>113<CR>127<CR>131<CR>137<CR>139<CR>149<CR>151<CR>157<CR>163<CR>167<CR>173<CR>179<CR>181<CR>191<CR>193<CR>197<CR>199<CR>211<CR>223<CR>227<CR>229<CR>233<CR>239<CR>241<CR>251<CR>257<CR>263<CR>269<CR>271<CR>277<CR>281<CR>283<CR>293<CR>307<CR>311<CR>313<CR>317<CR>331<CR>337<CR>347<CR>349<CR>353<CR>359<CR>367<CR>373<CR>379<CR>383<CR>389<CR>397<CR>401<CR>409<CR>419<CR>421<CR>431<CR>433<CR>439<CR>443<CR>449<CR>457<CR>461<CR>463<CR>467<CR>479<CR>487<CR>491<CR>499<CR>503<CR>509<CR>521<CR>523<CR>541<C-C><C-C>ZZ

0 comments

#65 kofi_annanymous / @kofi_annanymous - Score: 377 - 08/12/12 @ 22:17
ddi2<CR>3<CR>5<CR>7<CR>11<CR>13<CR>17<CR>19<CR>23<CR>29<CR>31<CR>37<CR>41<CR>43<CR>47<CR>53<CR>59<CR>61<CR>67<CR>71<CR>73<CR>79<CR>83<CR>89<CR>97<CR>101<CR>103<CR>107<CR>109<CR>113<CR>127<CR>131<CR>137<CR>139<CR>149<CR>151<CR>157<CR>163<CR>167<CR>173<CR>179<CR>181<CR>191<CR>193<CR>197<CR>199<CR>211<CR>223<CR>227<CR>229<CR>233<CR>239<CR>241<CR>251<CR>257<CR>263<CR>269<CR>271<CR>277<CR>281<CR>283<CR>293<CR>307<CR>311<CR>313<CR>317<CR>331<CR>337<CR>347<CR>349<CR>353<CR>359<CR>367<CR>373<CR>379<CR>383<CR>389<CR>397<CR>401<CR>409<CR>419<CR>421<CR>431<CR>433<CR>439<CR>443<CR>449<CR>457<CR>461<CR>463<CR>467<CR>479<CR>487<CR>491<CR>499<CR>503<CR>509<CR>521<CR>523<CR>541<Esc>:x<CR>

0 comments

#66 raj / @rajlekkala - Score: 378 - 12/30/10 @ 09:09
ddi2<CR>3<CR>5<CR>7<CR>11<CR>13<CR>17<CR>19<CR>23<CR>29<CR>31<CR>37<CR>41<CR>43<CR>47<CR>53<CR>59<CR>61<CR>67<CR>71<CR>73<CR>79<CR>83<CR>89<CR>97<CR>101<CR>103<CR>107<CR>109<CR>113<CR>127<CR>131<CR>137<CR>139<CR>149<CR>151<CR>157<CR>163<CR>167<CR>173<CR>179<CR>181<CR>191<CR>193<CR>197<CR>199<CR>211<CR>223<CR>227<CR>229<CR>233<CR>239<CR>241<CR>251<CR>257<CR>263<CR>269<CR>271<CR>277<CR>281<CR>283<CR>293<CR>307<CR>311<CR>313<CR>317<CR>331<CR>337<CR>347<CR>349<CR>353<CR>359<CR>367<CR>373<CR>379<CR>383<CR>389<CR>397<CR>401<CR>409<CR>419<CR>421<CR>431<CR>433<CR>439<CR>443<CR>449<CR>457<CR>461<CR>463<CR>467<CR>479<CR>487<CR>491<CR>499<CR>503<CR>509<CR>521<CR>523<CR>541<Esc>:wq<CR>

0 comments

#67 Mathias Fussenegger / @mfussenegger - Score: 380 - 06/07/11 @ 19:43
C2<CR>3<CR>5<CR>7<CR>11<CR>13<CR>17<CR>19<CR>23<CR>29<CR>31<CR>37<CR>41<CR>43<CR>47<CR>53<CR>59<CR>61<CR>67<CR>71<CR>73<CR>79<CR>83<CR>89<CR>97<CR>101<CR>103<CR>107<CR>109<CR>113<CR>127<CR>131<CR>137<CR>139<CR>149<CR>151<CR>157<CR>163<CR>167<CR>173<CR>179<CR>181<CR>191<CR>193<CR>197<CR>199<CR>211<CR>223<CR>227<CR>229<CR>233<CR>239<CR>241<CR>1<BS>251<CR>257<CR>263<CR>269<CR>271<CR>277<CR>281<CR>283<CR>293<CR>307<CR>311<CR>313<CR>317<CR>331<CR>337<CR>347<CR>349<CR>353<CR>359<CR>367<CR>373<CR>379<CR>383<CR>389<CR>397<CR>401<CR>409<CR>419<CR>421<CR>431<CR>433<CR>439<CR>443<CR>449<CR>457<CR>461<CR>463<CR>467<CR>479<CR>487<CR>491<CR>499<CR>503<CR>40<BS><BS>509<CR>521<CR>523<CR>541<Esc>ZZ

0 comments

Created by: @dstockwell

67 active golfers, 201 entries

Leaderboard (lowest score wins):
35
#1 - Urtica dioica / @udioica

08/04/2012 at 02:02AM

35
#2 - John Braxler / @braxler

07/30/2014 at 10:24PM

38
#3 - Kerson Hsiao / @KersonHsiao

11/24/2012 at 10:53AM

38
#4 - Marchand Paul-Valère / @pvmarch

03/03/2014 at 09:50PM

39
#5 - Joseph J. Piché / @jjpiche

08/26/2012 at 05:32AM

39
#6 - Conner McDaniel / @connermcd

09/19/2012 at 04:22AM

39
#7 - Hubba / @HubbaBubbaFett

12/27/2012 at 06:33PM

39
#8 - Petro Тrouq / @zulolosi

02/10/2013 at 10:19PM

43
#9 - Matthew Draper / @_matthewd

12/31/2010 at 05:11AM

43
#10 - Wei Dai / @clvv42

12/31/2010 at 05:56AM

43
#11 - Glenn / @spamcow_moo

01/03/2011 at 06:08PM

43
#12 - Ujjwol Lamichhane / @Ujjwol

01/06/2011 at 02:05PM

43
#13 - Balkoth / @_Balkoth_

01/08/2011 at 10:28PM

43
#14 - Oleg Roshupkin / @jjjahson

01/22/2011 at 08:29AM

43
#15 - SirVer / @SirVerII

01/24/2011 at 01:07PM

43
#16 - Justin Love / @wondible

06/24/2011 at 03:39PM

43
#17 - Hu Junfeng / @junfeng

07/19/2011 at 02:47PM

43
#18 - You-Siang Lin / @yslinnctu

12/02/2011 at 01:17AM

43
#19 - Jaime A. Sánchez / @jashbeta

12/22/2011 at 06:24AM

43
#20 - Rod Knowlton / @codelahoma

05/26/2012 at 03:44PM

43
#21 - John Whitley / @johnwhitley

08/11/2012 at 06:46PM

43
#22 - James Davis / @tripvg

08/14/2012 at 02:36PM

43
#23 - Vim rocks / @vimrocks

10/07/2012 at 09:07PM

43
#24 - Boer Asten / @astenboer

11/08/2012 at 07:28AM

43
#25 - Drew Neil / @nelstrom

11/26/2012 at 09:13PM

43
#26 - Kana Natsuno / @kana1

12/01/2012 at 03:17PM

43
#27 - Brent Carmer / @brent_carmer

04/14/2013 at 04:49AM

43
#28 - Thomas GUILLORY / @thomasguillory

02/28/2014 at 07:38PM

44
#29 - a24f0600 / @a24f0600

01/28/2013 at 05:12PM

47
#30 - Ole Hansen / @0hansen

06/14/2014 at 01:03PM

47
#31 - Haoxuan Yue / @yuehaoxuanar

08/03/2014 at 12:08PM

50
#32 - Mike Plotz / @antisuji

12/31/2010 at 08:49AM

52
#33 - William Dunand / @wdunand

11/29/2011 at 08:35AM

52
#34 - Vestrobaa / @Vestrobaa

07/21/2013 at 06:04PM

53
#35 - foo / @foo88832727

10/20/2013 at 04:03PM

59
#36 - Aurélien Delahaye / @alkove

01/03/2011 at 01:16AM

63
#37 - Philip Roberts / @philip_roberts

06/16/2012 at 05:30PM

64
#38 - Przemysław Pawełczyk / @przemoc86

01/16/2011 at 01:05PM

66
#39 - Renat Aksitov / @Korvin79

02/18/2012 at 09:22AM

73
#40 - dominique pellé / @vimgolfisto

01/04/2011 at 03:03PM

77
#41 - Ankit Shankar / @thelastnode

12/30/2010 at 09:25AM

81
#42 - I / @ForgetIt17

10/15/2013 at 12:29PM

83
#43 - Joonas Pihlajamaa / @jokkebk

02/21/2014 at 01:25PM

84
#44 - yusukesasaki / @yysaki

08/27/2013 at 01:23PM

88
#45 - Marcin Sza / @coot_

09/18/2012 at 10:28PM

89
#46 - Israel Chauca F. / @Raimondi

01/01/2011 at 07:10AM

89
#47 - Prody / @Prody225

08/13/2012 at 02:18AM

94
#48 - Trevor Powell / @DoomedBunnies

12/07/2011 at 05:39AM

96
#49 - Kurt Gaastra / @KGaastra

02/15/2012 at 04:37AM

104
#50 - Tim Chase / @gumnos

01/13/2011 at 08:31PM

112
#51 - Black Wolf / @LoboVimGolf

06/17/2011 at 09:05AM

115
#52 - Clint Tseng / @cxlt

12/30/2010 at 09:46PM

135
#53 - Pete Johns / @johnsyweb

01/10/2011 at 04:58PM

147
#54 - mightyfoo / @mightyfoo

05/26/2011 at 04:10PM

192
#55 - h_east (DDD ready) / @h_east

01/29/2011 at 01:12PM

252
#56 - Hung Huu Hoang / @hungh3

01/02/2011 at 06:55AM

278
#57 - drio / @drio

01/09/2011 at 05:24PM

374
#58 - Ron Gejman / @rongejman

12/30/2010 at 07:08AM

374
#59 - Behnam Esfahbod / @zwnj

12/30/2010 at 10:25AM

374
#60 - Alain Gilbert / @alain_gilbert

12/31/2010 at 08:55PM

374
#61 - Joel Taylor / @joelteon_

01/01/2011 at 04:53AM

374
#62 - Stephan Weller / @stephan_weller

01/06/2011 at 10:45AM

374
#63 - 無ん垢の叫び / @john_ababa

02/23/2012 at 03:49PM

376
#64 - vimja / @vimja666

03/16/2012 at 03:03AM

377
#65 - kofi_annanymous / @kofi_annanymous

08/12/2012 at 10:17PM

378
#66 - raj / @rajlekkala

12/30/2010 at 09:09AM

380
#67 - Mathias Fussenegger / @mfussenegger

06/07/2011 at 07:43PM