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 188 remaining solutions by signing in and submitting your own entry
#189 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

189 active golfers, 694 entries

Leaderboard (lowest score wins):
18
#121 - ubaldot / @ubaldot

03/27/2024 at 11:51PM

18
#122 - Martin Harvan / @martinhrvn

04/27/2024 at 07:41PM

18
#123 - Matan Avitan / @MatanAvitan

05/04/2024 at 05:26PM

19
#124 - reatter / @reatter

09/17/2024 at 01:14PM

20
#125 - Sébastien Matharel / @s_cognac

10/23/2023 at 09:05PM

21
#126 - ilyas / @Ahaaah2071

09/11/2023 at 10:59AM

21
#127 - Adrien Beudin / @beudbeud

12/08/2023 at 02:40PM

21
#128 - Ilya Shakirov / @ilya-shakirov

03/07/2024 at 12:12PM

22
#129 - mrmujo / @mrmujo

12/21/2023 at 06:37PM

23
#130 - Johan Isaksson / @JohanIsaks56389

09/08/2023 at 06:37AM

23
#131 - Dominic Evans / @oldmanuk

09/21/2023 at 12:58PM

24
#132 - alexscott / @4l3xsc0tt

11/06/2023 at 09:21PM

24
#133 - TechPersonYT / @TechPersonYT

03/22/2024 at 04:08PM

25
#134 - Djairo / @djairoh

12/04/2023 at 07:09PM

26
#135 - erik.forex / @ErikForex

10/05/2023 at 11:51AM

27
#136 - zxalone / @zxalone

03/27/2024 at 09:14AM

28
#137 - noot_noot / @nootnoot_2_doot

09/05/2023 at 05:31AM

30
#138 - Pablo Cárdenas / @pablo_cardenasb

09/01/2023 at 10:32PM

30
#139 - Paul Molloy / @paulsmolloy

09/29/2023 at 08:02PM

30
#140 - Tomek / @Madghostek

04/19/2024 at 09:28PM

31
#141 - snkkid / @snkkid

11/06/2023 at 01:44PM

31
#142 - Páll Pálsson / @DrLlap

03/26/2024 at 12:07PM

32
#143 - M / @M48026710

10/08/2023 at 08:34PM

33
#144 - Lukasz Sroka / @louqash

11/23/2023 at 05:21PM

33
#145 - Jose Ignacio / @JoseIgnacioGC

12/12/2023 at 07:47PM

33
#146 - richard-dunn / @richard-dunn

05/07/2024 at 08:32PM

34
#147 - Seok Hwan Kim / @gworldkim

10/14/2023 at 02:42PM

34
#148 - Alexandre Huot / @AlexandreHuot1

10/30/2023 at 12:59AM

34
#149 - Karlo Bartolic / @fwslash

02/06/2024 at 08:32PM

34
#150 - Håkon Anders Strømsodd / @haakon8855

04/03/2024 at 01:50PM