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 26 remaining solutions by signing in and submitting your own entry
#27 Kaepa69 / @kaepa3 - Score: 59 - 09/09/23 @ 00:14
0<C-Q>lwGeehdjj7i <Esc>jVG:s/\v\s<BS><BS>^]<BS>\s*<BS>{3,4}/<C-V><Tab>/<CR>jkkkkkwhxjx:wq<CR>

0 comments


Created by: @FnMailbox

27 active golfers, 71 entries

Leaderboard (lowest score wins):
12
#1 - Danilo J. S. Bellini / @danilobellini

09/02/2023 at 04:08PM

12
#2 - Smylers / @Smylers2

09/03/2023 at 07:58AM

12
#3 - Jean George / @JeanGeo20504212

09/03/2023 at 06:38PM

12
#4 - Petro Тrouq / @zulolosi

09/03/2023 at 07:05PM

12
#5 - John Braxler / @braxler

09/05/2023 at 08:57PM

12
#6 - Jon Krause / @jkrause314

09/07/2023 at 05:36AM

12
#7 - Daniel Apt / @DanielApt

09/10/2023 at 08:40AM

12
#8 - A C / @r4mmerAC

09/13/2023 at 01:50AM

12
#9 - Michael Brauweiler / @m_brauweiler

09/13/2023 at 04:45PM

12
#10 - Андрей Куренков (Arey) / @Arey_65536

09/18/2023 at 06:44PM

12
#11 - Mohammad Apel Mahmod / @apel_mahmod

09/21/2023 at 03:41PM

13
#12 - Matthew Finlayson / @mattf1n

09/02/2023 at 08:07PM

13
#13 - Victor Phan / @Victor_Phan

09/04/2023 at 12:26AM

13
#14 - Milan Blažek / @Somin13

09/04/2023 at 08:59AM

13
#15 - Monkey Boy / @monkey29089

09/21/2023 at 02:03PM

15
#16 - Abdelrahman Madkour / @A3Madkour

09/06/2023 at 04:27PM

18
#17 - Jeffrey Chen / @Jeff_Chenster

09/09/2023 at 07:51PM

21
#18 - ilyas / @Ahaaah2071

09/11/2023 at 10:59AM

23
#19 - Johan Isaksson / @JohanIsaks56389

09/08/2023 at 06:37AM

23
#20 - Dominic Evans / @oldmanuk

09/21/2023 at 12:58PM

28
#21 - noot_noot / @nootnoot_2_doot

09/05/2023 at 05:31AM

30
#22 - Pablo Cárdenas / @pablo_cardenasb

09/01/2023 at 10:32PM

35
#23 - d44d3w / @d44d3w

09/04/2023 at 11:42PM

37
#24 - Andrew Pritchard / @pilotInPyjamas

09/04/2023 at 11:26AM

39
#25 - ATW / @viveremedices

09/11/2023 at 01:19PM

48
#26 - Dyson / @DoctorDalek1963

09/15/2023 at 11:06AM

59
#27 - Kaepa69 / @kaepa3

09/09/2023 at 12:14AM