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 9v0064f211df000000000255

Remove line numbers

From http://web.archive.org/web/20140831121704/http://dirac.org/linux/gdb/02a-Memory_Layout_And_The_Stack.php#investigatingthestackwithgdb.

Start file
   1    #include<stdio.h>
   2    static void display(int i, int *ptr);
   3    
   4    int main(void) {
   5       int x = 5;
   6       int *xptr = &x;
   7       printf("In main():\n");
   8       printf("   x is %d and is stored at %p.\n", x, &x);
   9       printf("   xptr points to %p which holds %d.\n", xptr, *xptr);
   10      display(x, xptr);
   11      return 0;
   12   }
   13   
   14    void display(int z, int *zptr) {
   15    	printf("In display():\n");
   16       printf("   z is %d and is stored at %p.\n", z, &z);
   17       printf("   zptr points to %p which holds %d.\n", zptr, *zptr);
   18   }
End file
#include<stdio.h>
static void display(int i, int *ptr);
       
int main(void) {
	int x = 5;
	int *xptr = &x;
	printf("In main():\n");
	printf("   x is %d and is stored at %p.\n", x, &x);
	printf("   xptr points to %p which holds %d.\n", xptr, *xptr);
	display(x, xptr);
	return 0;
}

void display(int z, int *zptr) {
	printf("In display():\n");
	printf("   z is %d and is stored at %p.\n", z, &z);
	printf("   zptr points to %p which holds %d.\n", zptr, *zptr);
}

View Diff

1,18c1,18
<    1    #include<stdio.h>
<    2    static void display(int i, int *ptr);
<    3    
<    4    int main(void) {
<    5       int x = 5;
<    6       int *xptr = &x;
<    7       printf("In main():\n");
<    8       printf("   x is %d and is stored at %p.\n", x, &x);
<    9       printf("   xptr points to %p which holds %d.\n", xptr, *xptr);
<    10      display(x, xptr);
<    11      return 0;
<    12   }
<    13   
<    14    void display(int z, int *zptr) {
<    15    	printf("In display():\n");
<    16       printf("   z is %d and is stored at %p.\n", z, &z);
<    17       printf("   zptr points to %p which holds %d.\n", zptr, *zptr);
<    18   }
---
> #include<stdio.h>
> static void display(int i, int *ptr);
>        
> int main(void) {
> 	int x = 5;
> 	int *xptr = &x;
> 	printf("In main():\n");
> 	printf("   x is %d and is stored at %p.\n", x, &x);
> 	printf("   xptr points to %p which holds %d.\n", xptr, *xptr);
> 	display(x, xptr);
> 	return 0;
> }
> 
> void display(int z, int *zptr) {
> 	printf("In display():\n");
> 	printf("   z is %d and is stored at %p.\n", z, &z);
> 	printf("   zptr points to %p which holds %d.\n", zptr, *zptr);
> }

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 78 remaining solutions by signing in and submitting your own entry
#79 Sam / @sam_rands - Score: 110 - 09/27/23 @ 17:40
hhhhhhhhhhhhh<C-V>llllllljjjjjjjjjjjjjjjjjjjjjjdjji       <Esc>jjhhhhhh<C-V>jjjjjjllc<Tab><Esc><Esc>jjjjjjjjj0xj<C-V>jjlllc<Tab><Esc><Esc>xxuulxxxx:x<CR>

0 comments


Created by: @FnMailbox

79 active golfers, 266 entries

Leaderboard (lowest score wins):
12
#31 - anakojm / @anakojm

11/12/2023 at 01:31PM

12
#32 - MonkieeBoi / @MonkieeBoi

11/22/2023 at 05:33AM

12
#33 - くりち / 栗原佑弥 / @kurichi97

11/24/2023 at 03:38PM

12
#34 - 悟史 / @A1OBJTxN5fTg5EJ

11/28/2023 at 03:32PM

12
#35 - Frédéric Heulin / @talineo

11/29/2023 at 10:19AM

12
#36 - Michael Chen / @mchen91

11/30/2023 at 03:56AM

12
#37 - herbage / @herbage2

11/30/2023 at 11:10PM

13
#38 - Matthew Finlayson / @mattf1n

09/02/2023 at 08:07PM

13
#39 - Victor Phan / @Victor_Phan

09/04/2023 at 12:26AM

13
#40 - Milan Blažek / @Somin13

09/04/2023 at 08:59AM

13
#41 - Monkey Boy / @monkey29089

09/21/2023 at 02:03PM

13
#42 - Aaron Hunt / @ach5910

09/27/2023 at 05:29PM

13
#43 - Lithrein / @Lithrein

10/01/2023 at 12:44AM

13
#44 - Cameron / @0b01000011

10/05/2023 at 10:23PM

13
#45 - Arthur DELORT / @artDelort

10/24/2023 at 03:03PM

13
#46 - Fati Haziri / @BigKingFati

11/11/2023 at 03:08PM

13
#47 - Opus28 / @Opus28

11/21/2023 at 02:04AM

15
#48 - Abdelrahman Madkour / @A3Madkour

09/06/2023 at 04:27PM

15
#49 - Maurice Schmicking / @m_schmicking

10/28/2023 at 09:13PM

16
#50 - wemgulf / @wemgulfer

11/02/2023 at 04:19PM

18
#51 - Jeffrey Chen / @Jeff_Chenster

09/09/2023 at 07:51PM

20
#52 - Sébastien Matharel / @s_cognac

10/23/2023 at 09:05PM

21
#53 - ilyas / @Ahaaah2071

09/11/2023 at 10:59AM

23
#54 - Johan Isaksson / @JohanIsaks56389

09/08/2023 at 06:37AM

23
#55 - Dominic Evans / @oldmanuk

09/21/2023 at 12:58PM

24
#56 - alexscott / @4l3xsc0tt

11/06/2023 at 09:21PM

26
#57 - erik.forex / @ErikForex

10/05/2023 at 11:51AM

28
#58 - noot_noot / @nootnoot_2_doot

09/05/2023 at 05:31AM

30
#59 - Pablo Cárdenas / @pablo_cardenasb

09/01/2023 at 10:32PM

30
#60 - Paul Molloy / @paulsmolloy

09/29/2023 at 08:02PM