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

Compile C

You might have to get clever to do this one.

Start file
int main()
{
 
char *s = "Hello, world!";
 
int i, j;

 
for (i = 0; s[i]; i++) {
   
for (j = 0; j <= i; j++)
      putchar
(s[j]);
    putchar
('\n');
 
}

 
return 0;
}
End file
H
He
Hel
Hell
Hello
Hello,
Hello,
Hello, w
Hello, wo
Hello, wor
Hello, worl
Hello, world
Hello, world!

View Diff

1,13c1,13
< int main()
< {
<   char *s = "Hello, world!";
<   int i, j;
<
<   for (i = 0; s[i]; i++) {
<     for (j = 0; j <= i; j++)
<       putchar(s[j]);
<     putchar('\n');
<   }
<
<   return 0;
< }
---
> H
> He
> Hel
> Hell
> Hello
> Hello,
> Hello,
> Hello, w
> Hello, wo
> Hello, wor
> Hello, worl
> Hello, world
> Hello, world!

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 140 remaining solutions by signing in and submitting your own entry
#141 Taras Parshenko / @Timestreched - Score: 151 - 04/30/12 @ 20:43
9dw3wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww<Left><Up><Up><Up><Up><Up><Up><Up><Up><Up><Up><Up><Up><Up><Up><Up><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Left>47dwuu9dw3w49dwu48dwu47dwul47dwu48dw^qayyi<CR><Esc><Up>uqqayyp<Up>$x^q@au11@a:wq!<CR>

0 comments


Created by: @nooodl

141 active golfers, 430 entries

Leaderboard (lowest score wins):
21
#61 - Nolen Royalty / @NolenRoyalty

04/22/2012 at 03:21AM

21
#62 - Kerson Hsiao / @KersonHsiao

05/06/2012 at 04:49PM

21
#63 - Andrew D. Wong / @andrewdwong

07/16/2012 at 05:57PM

21
#64 - Oliver Mader / @dotb52

07/17/2012 at 07:15AM

21
#65 - Daniel S / @smatter0ne

07/17/2012 at 10:48PM

21
#66 - tmr / @tmr314

09/05/2012 at 10:41AM

21
#67 - Nathan / @boysetsfrog

10/20/2012 at 12:41PM

21
#68 - a24f0600 / @a24f0600

02/07/2013 at 01:55PM

21
#69 - Edgar Hipp / @EdgarHipp

11/14/2013 at 08:42PM

21
#70 - Joonas Pihlajamaa / @jokkebk

02/23/2014 at 09:52PM

21
#71 - Zapata / @Incredible_JFP

05/23/2014 at 10:46PM

21
#72 - Haoxuan Yue / @yuehaoxuanar

07/19/2014 at 02:10PM

21
#73 - Caek / @Caek_

08/19/2014 at 02:32AM

21
#74 - Matt / @mcr05

10/28/2014 at 08:51PM

21
#75 - pftb12345 / @pftb12345

03/28/2015 at 05:32AM

21
#76 - Clark DuVall / @theclarkatron

05/25/2015 at 05:15AM

21
#77 - kiou / @smallletterquu

12/05/2015 at 03:01AM

21
#78 - x03n046 / @x03n046

06/20/2022 at 08:45AM

21
#79 - Alex / @AlexanderHeatl2

07/01/2022 at 05:56PM

21
#80 - かみひろ / @km_hr

02/04/2023 at 11:52AM

22
#81 - Fer Enaf / @0x00C0FFEE

12/30/2010 at 11:59AM

22
#82 - Wei Dai / @clvv42

12/30/2010 at 11:59AM

22
#83 - Ujjwol Lamichhane / @Ujjwol

12/30/2010 at 12:12PM

22
#84 - Adam Pohorecki / @apohorecki

12/30/2010 at 12:27PM

22
#85 - Gael / @darkael2

12/30/2010 at 12:37PM

22
#86 - Jordan Lewis / @JordanALewis

12/30/2010 at 06:29PM

22
#87 - oliboli / @oliboliboli

01/06/2011 at 11:43AM

22
#88 - Dan Masquelier / @danmasq

07/02/2011 at 05:03PM

22
#89 - r / @tricosahedron

01/13/2013 at 04:50PM

22
#90 - Tyler / @tylerbindon

04/05/2013 at 03:56AM