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 38 remaining solutions by signing in and submitting your own entry
#39 John Braxler / braxler - Score: 16 - 10/01/14 @ 17:58
:se sw=4 et<CR>=GZZ

0 comments

#40 Jake Eskel / JakeEskel - Score: 16 - 12/31/14 @ 13:46
:se sw=4 et<CR>=GZZ

0 comments

#41 Matthieu Crapet / mcr05 - Score: 16 - 01/01/15 @ 15:34
:se et sw=4<CR>=GZZ

0 comments

#42 pftb12345 / pftb12345 - Score: 16 - 04/19/15 @ 13:08
:se sw=4 et<CR>=GZZ

0 comments

#43 Jon Krause / jkrause314 - Score: 16 - 01/15/16 @ 07:54
:se et sw:4<CR>=GZZ

0 comments

#44 mesacul / mesacul - Score: 16 - 05/23/17 @ 05:06
:se et sw=4<CR>=GZZ

0 comments

#45 Terry Ding / TerryDing77 - Score: 16 - 08/22/17 @ 21:04
:se sw=4 et<CR>=GZZ

0 comments

#46 adi li / guessimtoolate - Score: 17 - 12/09/12 @ 10:31
:set sw=4 et<CR>=GZZ

0 comments

#47 Chase Stubblefield / sterlingchase - Score: 17 - 04/28/13 @ 09:18
:set et sw=4<CR>=GZZ

0 comments

#48 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

48 active golfers, 54 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

16
#3 - Urtica dioica / udioica

12/07/2012 at 07:20AM

16
#4 - Marcin Sza / coot_

12/07/2012 at 11:57AM

16
#5 - Tim Chase / gumnos

12/07/2012 at 04:44PM

16
#6 - Conner McDaniel / connermcd

12/07/2012 at 06:06PM

16
#7 - Eric Andres / eric_m_andres

12/07/2012 at 06:07PM

16
#8 - Arun / UArunKumar

12/08/2012 at 03:24AM

16
#9 - Hubba / HubbaBubbaFett

12/08/2012 at 03:27PM

16
#10 - Adelar S. Queiróz / adelarsq

12/08/2012 at 04:14PM

16
#11 - Kerson Hsiao / KersonHsiao

12/09/2012 at 07:11AM

16
#12 - 無ん垢の叫び / john_ababa

12/09/2012 at 11:21AM

16
#13 - Ray Lehtiniemi / rayll

12/09/2012 at 06:46PM

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

12/11/2012 at 04:01AM

16
#15 - Chris Maguire / chriswmaguire

12/11/2012 at 05:02PM

16
#16 - A / a_akessler

12/11/2012 at 09:05PM

16
#17 - うえっち / uh_tomo

12/13/2012 at 06:48PM

16
#18 - Alex Shapovalov / shapov

12/14/2012 at 11:28PM

16
#19 - John GraphFrog / FragOnly

12/17/2012 at 03:22PM

16
#20 - cheerfulstoic / cheerfulstoic

12/28/2012 at 09:09PM

16
#21 - Alec Goebel / zego5360

01/04/2013 at 04:06AM

16
#22 - Petro Тrouq / zulolosi

03/08/2013 at 06:13AM

16
#23 - Trevor Powell / DoomedBunnies

03/20/2013 at 03:51AM

16
#24 - Brandon T. Fields / cdated

03/22/2013 at 03:35AM

16
#25 - Tyler / tylerbindon

04/03/2013 at 03:21AM

16
#26 - nkoehring / nkoehring

04/04/2013 at 01:55PM

16
#27 - Adit Cahya Ramadhan / aditcr8

05/16/2013 at 10:05AM

16
#28 - Kai Yuan / kentyuan

05/25/2013 at 09:10PM

16
#29 - Marco Hinz / _mhinz_

05/25/2013 at 09:26PM

16
#30 - Norm Fasey / DeathRay1977

06/21/2013 at 05:46PM

16
#31 - James / Dronak

09/01/2013 at 11:49PM

16
#32 - yaon / yaon4

09/10/2013 at 01:54PM

16
#33 - Strabs / artistavenue

02/05/2014 at 01:40PM

16
#34 - Xelrifos / Xelrifos

02/23/2014 at 12:41PM

16
#35 - Joonas Pihlajamaa / jokkebk

04/01/2014 at 11:27AM

16
#36 - Alex / ven_y_toma

05/18/2014 at 09:18PM

16
#37 - Caek / Caek_

07/08/2014 at 05:03AM

16
#38 - Justin Knag / justinknag

09/03/2014 at 04:12PM

16
#39 - John Braxler / braxler

10/01/2014 at 05:58PM

16
#40 - Jake Eskel / JakeEskel

12/31/2014 at 01:46PM

16
#41 - Matthieu Crapet / mcr05

01/01/2015 at 03:34PM

16
#42 - pftb12345 / pftb12345

04/19/2015 at 01:08PM

16
#43 - Jon Krause / jkrause314

01/15/2016 at 07:54AM

16
#44 - mesacul / mesacul

05/23/2017 at 05:06AM

16
#45 - Terry Ding / TerryDing77

08/22/2017 at 09:04PM

17
#46 - adi li / guessimtoolate

12/09/2012 at 10:31AM

17
#47 - Chase Stubblefield / sterlingchase

04/28/2013 at 09:18AM

33
#48 - z0k / z0k

12/19/2012 at 12:36PM