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):
16
#31 - Norm Fasey / @DeathRay1977

06/21/2013 at 05:46PM

16
#32 - James / @Dronak

09/01/2013 at 11:49PM

16
#33 - yaon / @yaon4

09/10/2013 at 01:54PM

16
#34 - Strabs / @artistavenue

02/05/2014 at 01:40PM

16
#35 - Xelrifos / @Xelrifos

02/23/2014 at 12:41PM

16
#36 - Joonas Pihlajamaa / @jokkebk

04/01/2014 at 11:27AM

16
#37 - Alex / @ven_y_toma

05/18/2014 at 09:18PM

16
#38 - Caek / @Caek_

07/08/2014 at 05:03AM

16
#39 - Justin Knag / @justinknag

09/03/2014 at 04:12PM

16
#40 - John Braxler / @braxler

10/01/2014 at 05:58PM

16
#41 - Jake Eskel / @JakeEskel

12/31/2014 at 01:46PM

16
#42 - Matt / @mcr05

01/01/2015 at 03:34PM

16
#43 - pftb12345 / @pftb12345

04/19/2015 at 01:08PM

16
#44 - Jon Krause / @jkrause314

01/15/2016 at 07:54AM

16
#45 - mesacul / @mesacul

05/23/2017 at 05:06AM

16
#46 - Terry Ding / @TerryDing77

08/22/2017 at 09:04PM

16
#47 - Alex / @AlexanderHeatl2

07/08/2022 at 10:21PM

16
#48 - vuems / @vuems2win

12/01/2022 at 12:17AM

17
#49 - adi li / @guessimtoolate

12/09/2012 at 10:31AM

17
#50 - Chasetopher / @chasetopherlee

04/28/2013 at 09:18AM

17
#51 - Kenny Low / @kennylow

08/19/2019 at 09:21AM

17
#52 - RockerZZY / @rocker_zzy

06/16/2020 at 04:55AM

18
#53 - Olivier Bégassat / @zk_evm

06/15/2023 at 08:05PM

28
#54 - ひま / @sux2mfgj_gz

11/28/2022 at 10:48AM

33
#55 - z0k / @z0k

12/19/2012 at 12:36PM