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 185 remaining solutions by signing in and submitting your own entry
#186 Edgar Catalán / @edgardini - Score: 157 - 01/16/24 @ 00:50
:<Up><Up><Up><Up><Down><Down><Up><Down><Up>%s/\<BS>^s<BS>\s\+\d|<BS>\+\s\<BS>\{\}<Left><Left>2,<Left><BS>4<BS>5<BS>4<BS>5<BS>4<BS>1<Right><Right><Right><Right><BS><BS><BS><BS><BS><BS><BS><BS><CR>:%s/^\s\+<BS>{4,\}<Left><Left><Left><BS>5<Right><Right><Right><Right><Right><Right><Right>/\t<CR><Esc>kkkkjjjjkkk0:%s/\<BS>^\s\{2,\}/<CR>:5S<BS><BS><BS>jjkkkkkkkkk000kkkgg<Esc>:wq<CR>

0 comments


Created by: @FnMailbox

186 active golfers, 682 entries

Leaderboard (lowest score wins):
13
#91 - Matt Shen / @mattshen

01/23/2024 at 06:22AM

13
#92 - jonas-grobe / @jonas-grobe

02/02/2024 at 09:52AM

13
#93 - Quentin de Andria / @QuentindeA

02/03/2024 at 05:42PM

13
#94 - @grhkm@infosec.exchange / @grhkm21

03/24/2024 at 03:11AM

13
#95 - SnakitoGamer4160 / @SnakitoGamer4160

04/07/2024 at 02:47PM

13
#96 - Kanmuruuruu / @Kanmuruuruu

04/07/2024 at 04:23PM

13
#97 - heog / @Heogy

04/24/2024 at 09:09AM

13
#98 - Petr Hodač / @PetrHodac

08/29/2024 at 09:51AM

13
#99 - rhasarub / @rhasarub

09/11/2024 at 07:11PM

14
#100 - Ludovic Schwartz / @ludovicschwartz

11/16/2023 at 03:19PM

14
#101 - nikita-talalai / @nikita-talalai

12/19/2023 at 05:05PM

14
#102 - Jasper v. B. / @jazzpi

12/30/2023 at 12:59PM

14
#103 - armaninux / @armaninux

04/04/2024 at 01:46PM

14
#104 - Thijs / @Liulangzhe98

04/18/2024 at 02:36PM

14
#105 - Emil Miler / @realcharmer

06/05/2024 at 11:56AM

15
#106 - Abdelrahman Madkour / @A3Madkour

09/06/2023 at 04:27PM

15
#107 - Maurice Schmicking / @m_schmicking

10/28/2023 at 09:13PM

15
#108 - DavidJArnold / @DavidJArnold

03/29/2024 at 07:02AM

16
#109 - wemgulf / @wemgulfer

11/02/2023 at 04:19PM

16
#110 - Ivo Blöchliger / @aigledesalpes

05/23/2024 at 05:59PM

16
#111 - Danylo Lykov / @danlkv

06/07/2024 at 03:02AM

16
#112 - NotWearingPants / @NotWearingPants

08/06/2024 at 12:18AM

16
#113 - sammy-kablammy / @sammy-kablammy

08/24/2024 at 09:55PM

17
#114 - Fellow-fiend / @Fellow-fiend

05/20/2024 at 12:30AM

17
#115 - nerfed / @nerfed

06/04/2024 at 01:22PM

18
#116 - Jeffrey Chen / @Jeff_Chenster

09/09/2023 at 07:51PM

18
#117 - egitto / @egitto

01/04/2024 at 06:48PM

18
#118 - Pieter-Jan Lavaerts / @Pumpkin_Pie_Eat

03/08/2024 at 12:42PM

18
#119 - ubaldot / @ubaldot

03/27/2024 at 11:51PM

18
#120 - Martin Harvan / @martinhrvn

04/27/2024 at 07:41PM