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

166 active golfers, 617 entries

Leaderboard (lowest score wins):
12
#61 - Ilya Gavrilov / @devgavrilov

05/15/2024 at 10:29PM

12
#62 - Paul McDowell / @etothepi16

05/21/2024 at 09:17PM

12
#63 - Tsimon Dorakh / @Tsimon-Dorakh

05/30/2024 at 07:26PM

12
#64 - Don'tBeAlarmed / @DontBeAlarmed

05/31/2024 at 08:13PM

12
#65 - Josh Moody / @joshmoody24

06/09/2024 at 05:29AM

13
#66 - Matthew Finlayson / @mattf1n

09/02/2023 at 08:07PM

13
#67 - Victor Phan / @Victor_Phan

09/04/2023 at 12:26AM

13
#68 - Milan Blažek / @Somin13

09/04/2023 at 08:59AM

13
#69 - Monkey Boy / @monkey29089

09/21/2023 at 02:03PM

13
#70 - Aaron Hunt / @ach5910

09/27/2023 at 05:29PM

13
#71 - Lithrein / @Lithrein

10/01/2023 at 12:44AM

13
#72 - Cameron / @0b01000011

10/05/2023 at 10:23PM

13
#73 - Arthur DELORT / @artDelort

10/24/2023 at 03:03PM

13
#74 - Fati Haziri / @BigKingFati

11/11/2023 at 03:08PM

13
#75 - Orks / @OrkWard

11/18/2023 at 09:38AM

13
#76 - Leon Katsnelson / @leonkatsnelson

11/21/2023 at 02:04AM

13
#77 - Littlepants / @gilbert12tw

12/02/2023 at 06:19AM

13
#78 - Adrián Fidalgo-Díaz / @adrianFD22

12/15/2023 at 05:24PM

13
#79 - Matt Zhang / @MattUnderscoreZhang

01/03/2024 at 09:06PM

13
#80 - Tom Anderson / @andogq

01/13/2024 at 03:14AM

13
#81 - Matt Shen / @mattshen

01/23/2024 at 06:22AM

13
#82 - jonas-grobe / @jonas-grobe

02/02/2024 at 09:52AM

13
#83 - Quentin de Andria / @QuentindeA

02/03/2024 at 05:42PM

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

03/24/2024 at 03:11AM

13
#85 - SnakitoGamer4160 / @SnakitoGamer4160

04/07/2024 at 02:47PM

13
#86 - Kanmuruuruu / @Kanmuruuruu

04/07/2024 at 04:23PM

13
#87 - heog / @Heogy

04/24/2024 at 09:09AM

14
#88 - Ludovic Schwartz / @ludovicschwartz

11/16/2023 at 03:19PM

14
#89 - nikita-talalai / @nikita-talalai

12/19/2023 at 05:05PM

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

12/30/2023 at 12:59PM