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):
12
#31 - Blake Wingard / @Bats6789

11/16/2023 at 02:51PM

12
#32 - MonkieeBoi / @MonkieeBoi

11/22/2023 at 05:33AM

12
#33 - くりち / 栗原佑弥 / @kurichi97

11/24/2023 at 03:38PM

12
#34 - 悟史 / @A1OBJTxN5fTg5EJ

11/28/2023 at 03:32PM

12
#35 - Frédéric Heulin / @talineo

11/29/2023 at 10:19AM

12
#36 - Michael Chen / @mchen91

11/30/2023 at 03:56AM

12
#37 - herbage / @herbage2

11/30/2023 at 11:10PM

12
#38 - Eric Dobson / @ericdobson

12/08/2023 at 01:25AM

12
#39 - Elcio Ferreira / @elcio

12/12/2023 at 10:34PM

12
#40 - Qing Liu / @poeminlash

12/14/2023 at 03:48AM

12
#41 - Ada Lerner / @scrivener

12/24/2023 at 06:13AM

12
#42 - Michael / @openemitter

12/25/2023 at 08:46PM

12
#43 - jeffreymrussell / @jeffreymrussell

01/03/2024 at 03:36PM

12
#44 - BlockLune / @BlockLune

01/07/2024 at 01:12PM

12
#45 - Josh Callender / @Saponifi3d

01/10/2024 at 09:52PM

12
#46 - epsilonshnepsilon / @epsilonshnepsilon

01/15/2024 at 07:18PM

12
#47 - Caesar 🏴󠁧󠁢󠁷󠁬󠁳󠁿 / @NotRexButCaesar

01/17/2024 at 12:43AM

12
#48 - RiskyDissonance / @riskydissonance

02/19/2024 at 10:05AM

12
#49 - Panda-Ghost / @Panda-Ghost

02/23/2024 at 06:39AM

12
#50 - Mitchel Kerckhaert / @MitchelKerckhaert

03/04/2024 at 02:21PM

12
#51 - Jinli Xiao / @jinlixiao

03/11/2024 at 09:53PM

12
#52 - Brian Curless / @bwcurless

03/14/2024 at 11:22PM

12
#53 - shikitanrei / @shikitanrei

03/22/2024 at 02:02PM

12
#54 - nightgather / @nightgather

03/27/2024 at 03:02AM

12
#55 - kizotic / @kizotic

03/29/2024 at 12:41AM

12
#56 - Aristotelis Dossas / @teldosas

03/29/2024 at 05:56PM

12
#57 - Aly Thobani / @alythobani

04/03/2024 at 11:16PM

12
#58 - Miter / @MiterMe

04/07/2024 at 02:17PM

12
#59 - logerse / @logerse

04/15/2024 at 05:19PM

12
#60 - constap / @constap

04/25/2024 at 04:01AM