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):
9
#1 - Gustav Kristensen / @gustavkrist

10/01/2024 at 06:51PM

10
#2 - Diwakar Singh Parmar / @parmardiwakar150

08/25/2024 at 04:55PM

11
#3 - jhjnjd44 / @jhjnjd44

08/16/2024 at 11:32AM

12
#4 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

09/02/2023 at 04:08PM

12
#5 - "Smylers" / @Smylers2

09/03/2023 at 07:58AM

12
#6 - Jean George / @JeanGeo20504212

09/03/2023 at 06:38PM

12
#7 - Petro Тrouq / @zulolosi

09/03/2023 at 07:05PM

12
#8 - John Braxler / @braxler

09/05/2023 at 08:57PM

12
#9 - Jon Krause / @jkrause314

09/07/2023 at 05:36AM

12
#10 - Daniel Apt / @DanielApt

09/10/2023 at 08:40AM

12
#11 - A C / @r4mmerAC

09/13/2023 at 01:50AM

12
#12 - Michael Brauweiler / @m_brauweiler

09/13/2023 at 04:45PM

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

09/18/2023 at 06:44PM

12
#14 - Mohammad Apel Mahmod / @apel_mahmod

09/21/2023 at 03:41PM

12
#15 - Adam / @Adam00000000002

09/23/2023 at 09:02AM

12
#16 - Mar_Anboksing / @roei99

09/24/2023 at 10:15AM

12
#17 - Josh Harrison / @ultrapasty

10/17/2023 at 04:16PM

12
#18 - oboki / @happy_oboki

10/18/2023 at 09:33AM

12
#19 - _ / @k_n_rvs

10/18/2023 at 03:29PM

12
#20 - Chris Braissant / @braissac

10/18/2023 at 04:48PM

12
#21 - NDavis / @D1727374757

10/18/2023 at 07:06PM

12
#22 - scpchicken / @scpchick

10/18/2023 at 08:07PM

12
#23 - tien / @tien40766111

10/19/2023 at 08:45AM

12
#24 - Alex Pepper / @AlexPepper1457

10/19/2023 at 08:59PM

12
#25 - Yassine Ibr / @yassineibr2001

10/22/2023 at 04:15PM

12
#26 - Sergej Karavajnij / @basyanya_sk

11/01/2023 at 11:26AM

12
#27 - Jonáš Šerých / @serycjon

11/07/2023 at 02:14PM

12
#28 - Henrique Malheiro / @rike09

11/09/2023 at 11:01AM

12
#29 - FilipRazek / @FilipRazek

11/09/2023 at 11:39AM

12
#30 - Anako Jeannin-Mallet / @anakojm

11/12/2023 at 01:31PM