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):
31
#61 - snkkid / @snkkid

11/06/2023 at 01:44PM

32
#62 - M / @M48026710

10/08/2023 at 08:34PM

33
#63 - Lukasz Sroka / @louqash

11/23/2023 at 05:21PM

34
#64 - Seok Hwan Kim / @gworldkim

10/14/2023 at 02:42PM

34
#65 - Alexandre Huot / @AlexandreHuot1

10/30/2023 at 12:59AM

35
#66 - d44d3w / @d44d3w

09/04/2023 at 11:42PM

37
#67 - Andrew Pritchard / @pilotInPyjamas

09/04/2023 at 11:26AM

38
#68 - Justinian III / @iii_justin64535

10/08/2023 at 12:10AM

39
#69 - ATW / @viveremedices

09/11/2023 at 01:19PM

40
#70 - Sachin Mudaliyar / @s4ch1n_

10/14/2023 at 09:28AM

44
#71 - Jose Ignacio / @JoseIgnacioGC

11/30/2023 at 04:51AM

47
#72 - Stefan Krist / @nerdyness_sk

10/24/2023 at 08:50PM

48
#73 - Dyson / @DoctorDalek1963

09/15/2023 at 11:06AM

50
#74 - LandR / @ListenAndR

10/12/2023 at 02:48AM

59
#75 - Kaepa69 / @kaepa3

09/09/2023 at 12:14AM

62
#76 - proz / @programmerz26

10/19/2023 at 02:16PM

76
#77 - andre / @pintoquete

09/22/2023 at 12:15PM

96
#78 - Håkon Anders Strømsodd / @haakon8855

11/13/2023 at 03:04PM

110
#79 - Sam / @sam_rands

09/27/2023 at 05:40PM