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 50c195c1b85576000200005b

fib.c cleanup

cleanup the file

Start file
/* Fibonacci Series c language */
#include<stdio.h>
 
main
()
{
   
int n, first = 0, second = 1, next, c;
 
   printf
("Enter the number of terms\n");
   scanf
("%d",&n);
 
   printf
("First %d terms of Fibonacci series are :-\n",n);
 
   
for ( c = 0 ; c < n ; c++ )
   
{
     
if ( c <= 1 )
         
next = c;
     
else
     
{
         
next = first + second;
         first
= second;
         second
= next;
     
}
      printf
("%d\n",next);
   
}
 
   
return 0;
}
End file
/* Fibonacci Series c language */
#include<stdio.h>

main
()
{
   
int n, first = 0, second = 1, next, c;

    printf
("Enter the number of terms\n");
    scanf
("%d",&n);

    printf
("First %d terms of Fibonacci series are :-\n",n);

   
for ( c = 0 ; c < n ; c++ )
   
{
       
if ( c <= 1 )
           
next = c;
       
else
       
{
           
next = first + second;
            first
= second;
            second
= next;
       
}
        printf
("%d\n",next);
   
}

   
return 0;
}

View Diff

diff --git a/input.txt b/output.txt
index 2256c5a..aeb1794 100644
--- a/input.txt
+++ b/output.txt
@@ -1,27 +1,27 @@
/* Fibonacci Series c language */
#include<stdio.h>

main
()
{
   
int n, first = 0, second = 1, next, c;

    printf
("Enter the number of terms\n");
    scanf
("%d",&n);

    printf
("First %d terms of Fibonacci series are :-\n",n);

   
for ( c = 0 ; c < n ; c++ )
   
{
       
if ( c <= 1 )
           
next = c;
       
else
       
{
           
next = first + second;
            first
= second;
            second
= next;
       
}
        printf
("%d\n",next);
   
}

   
return 0;
}

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 54 remaining solutions by signing in and submitting your own entry
#55 z0k / @z0k - Score: 33 - 12/19/12 @ 12:36
:6<CR><C-V>20jI <Esc>Mj<C-V>7jjA <Esc>ji <Esc>3j<C-V>jjA <Esc>ZZ

0 comments


Created by: @DiffJunk

55 active golfers, 68 entries

Leaderboard (lowest score wins):
15
#1 - a24f0600 / @a24f0600

12/12/2012 at 10:03AM

15
#2 - Reed Riley / @ReedRile

01/20/2013 at 03:04AM

15
#3 - Peppa Pig / @PeppaPigSg

08/14/2024 at 10:05AM

16
#4 - Urtica dioica / @udioica

12/07/2012 at 07:20AM

16
#5 - Marcin Szamotulski / @me_coot

12/07/2012 at 11:57AM

16
#6 - Tim Chase / @gumnos

12/07/2012 at 04:44PM

16
#7 - Conner McDaniel / @connermcd

12/07/2012 at 06:06PM

16
#8 - Eric Andres / @eric_m_andres

12/07/2012 at 06:07PM

16
#9 - Arun / @UArunKumar

12/08/2012 at 03:24AM

16
#10 - Hubba / @HubbaBubbaFett

12/08/2012 at 03:27PM

16
#11 - Adelar S. Queiróz / @adelarsq

12/08/2012 at 04:14PM

16
#12 - Kerson Hsiao / @KersonHsiao

12/09/2012 at 07:11AM

16
#13 - じょんあば / @john_ababa

12/09/2012 at 11:21AM

16
#14 - Ray Lehtiniemi / @rayll

12/09/2012 at 06:46PM

16
#15 - h_east (トロッコ6個) / @h_east

12/11/2012 at 04:01AM

16
#16 - Chris Maguire / @chriswmaguire

12/11/2012 at 05:02PM

16
#17 - Alan Kessler / @alankesslr

12/11/2012 at 09:05PM

16
#18 - うえっち / @uh_tomo

12/13/2012 at 06:48PM

16
#19 - Alex Shapovalov / @shapov

12/14/2012 at 11:28PM

16
#20 - Michael / @Amormzee

12/17/2012 at 03:22PM

16
#21 - cheerfulstoic / @cheerfulstoic

12/28/2012 at 09:09PM

16
#22 - Alec Goebel / @zego5360

01/04/2013 at 04:06AM

16
#23 - Petro Тrouq / @zulolosi

03/08/2013 at 06:13AM

16
#24 - Trevor Powell / @DoomedBunnies

03/20/2013 at 03:51AM

16
#25 - Brandon T. Fields / @cdated

03/22/2013 at 03:35AM

16
#26 - Tyler / @tylerbindon

04/03/2013 at 03:21AM

16
#27 - nkoehring / @nkoehring

04/04/2013 at 01:55PM

16
#28 - Adit Cahya Ramadhan / @aditcr8

05/16/2013 at 10:05AM

16
#29 - Kai Yuan / @kentyuan

05/25/2013 at 09:10PM

16
#30 - Marco Hinz / @_mhinz_

05/25/2013 at 09:26PM