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

198 active golfers, 736 entries

Leaderboard (lowest score wins):
32
#151 - M / @M48026710

10/08/2023 at 08:34PM

33
#152 - Lukasz Sroka / @louqash

11/23/2023 at 05:21PM

33
#153 - Jose Ignacio / @JoseIgnacioGC

12/12/2023 at 07:47PM

33
#154 - richard-dunn / @richard-dunn

05/07/2024 at 08:32PM

34
#155 - Seok Hwan Kim / @gworldkim

10/14/2023 at 02:42PM

34
#156 - Alexandre Huot / @AlexandreHuot1

10/30/2023 at 12:59AM

34
#157 - Karlo Bartolic / @fwslash

02/06/2024 at 08:32PM

35
#158 - d44d3w / @d44d3w

09/04/2023 at 11:42PM

36
#159 - Remus Dalrymple / @bornintheflames

12/06/2023 at 11:28PM

36
#160 - Yejun Kang / @Rinnnt

03/20/2024 at 12:11PM

37
#161 - Andrew Pritchard / @pilotInPyjamas

09/04/2023 at 11:26AM

38
#162 - Justinian III / @iii_justin64535

10/08/2023 at 12:10AM

38
#163 - Sebastian Steenssøe / @VildMedPap

02/17/2024 at 04:55PM

39
#164 - ATW / @viveremedices

09/11/2023 at 01:19PM

39
#165 - an-dr-eas-k / @an-dr-eas-k

12/15/2023 at 12:24PM

40
#166 - Sachin Mudaliyar / @s4ch1n_

10/14/2023 at 09:28AM

40
#167 - null / @err_not_nil

07/09/2024 at 02:20PM

41
#168 - Elvis Byounghoon Lee / @lbspresley

04/18/2024 at 02:38AM

41
#169 - Alex Khakhlyuk / @khakhlyuk

08/22/2024 at 08:13PM

41
#170 - a-irs / @a-irs

09/17/2024 at 07:49PM

42
#171 - Luke Terheyden / @terheyden

08/31/2024 at 09:23PM

43
#172 - ak@developer / @Ajay-056

09/21/2024 at 03:15PM

43
#173 - Jan Scholz / @radikalliberal

10/17/2024 at 08:48PM

46
#174 - mferrandon / @mferrandon

12/18/2023 at 09:07PM

47
#175 - Stefan Krist / @nerdyness_sk

10/24/2023 at 08:50PM

47
#176 - Let-me-C / @Let-me-C

03/12/2024 at 02:42PM

48
#177 - Dyson / @DoctorDalek1963

09/15/2023 at 11:06AM

48
#178 - TiOs-dev / @TiOs-dev

12/23/2023 at 11:05AM

48
#179 - Joshua / @H4ppy-04

06/08/2024 at 11:18AM

49
#180 - jpggpj / @jpggpj

12/10/2023 at 09:19PM