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 5a19a6be19128f03c2000010

42-header

Rush 42mexican-standoff at 42 school

Start file
void    read_loop(char *delim_string, char **ptr, int op, char **doc)
{
       
while(**ptr)
       
{
               
char    *tmp;
               
char    *tmp2;

                tmp
= *ptr;
               
while (**ptr && **ptr != '\n')
                       
(*ptr)++;
               
if (**ptr == '\n')
                       
(*ptr)++;
                tmp
= ft_strndup(tmp, *ptr - tmp);
               
if (op == DLESSDASH)
                        tmp
= remove_tab(tmp);
               
if (!ft_strcmp(delim_string, tmp))
                       
break;
        tmp2
= ft_strjoin(*doc, tmp);
                free
(*doc);
                free
(tmp);          
               
*doc = tmp2;
       
}
}
End file
void    read_loop(char *delim_string, char **ptr, int op, char **doc)
{
       
char    *tmp;
       
char    *tmp2;

       
while (**ptr)
       
{
                tmp
= *ptr;
               
while (**ptr && **ptr != '\n')
                       
(*ptr)++;
               
if (**ptr == '\n')
                       
(*ptr)++;
                tmp
= ft_strndup(tmp, *ptr - tmp);
               
if (op == DLESSDASH)
                        tmp
= remove_tab(tmp);
               
if (!ft_strcmp(delim_string, tmp))
                       
break ;
                tmp2
= ft_strjoin(*doc, tmp);
                free
(*doc);
                free
(tmp);
               
*doc = tmp2;
       
}
}

View Diff

3,6c3,4
<       while(**ptr)
<       {
<               char    *tmp;
<               char    *tmp2;
---
>       char    *tmp;
>       char    *tmp2;
7a6,7
>       while (**ptr)
>       {
11c11
<                 if (**ptr == '\n')
---
>               if (**ptr == '\n')
17,18c17,18
<                       break;
<         tmp2 = ft_strjoin(*doc, tmp);
---
>                       break ;
>               tmp2 = ft_strjoin(*doc, tmp);
20c20
<               free(tmp);          
---
>               free(tmp);

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 15 remaining solutions by signing in and submitting your own entry
#16 Benjamin Schindler / @beschindler - Score: 49 - 11/26/17 @ 07:56
5ggVjjd2ggpVj<6ggf(i <Esc>10ggA<Del><CR><Esc>17ggwi <Esc>j>>jjf;<Right>DZZ

0 comments


Created by: @VincentCombey

16 active golfers, 43 entries

Leaderboard (lowest score wins):
22
#1 - Kerson Hsiao / @KersonHsiao

11/30/2017 at 11:06AM

22
#2 - John Braxler / @braxler

12/01/2017 at 02:03PM

22
#3 - Ben Hill / @KaizenSoze70

12/01/2017 at 03:17PM

22
#4 - Jon Krause / @jkrause314

12/05/2017 at 03:42AM

22
#5 - 梧桐王子 / @WutongYujie

12/25/2017 at 12:27PM

22
#6 - Peppa Pig / @PeppaPigSg

06/28/2024 at 06:30AM

23
#7 - Arno / @arnoxmp

05/12/2019 at 09:47AM

23
#8 - Luoyb / @Luoyb

11/15/2023 at 02:27AM

27
#9 - macmental / @macmental

11/26/2017 at 09:06PM

27
#10 - ؜ / @h43z

12/03/2017 at 02:33AM

28
#11 - tPenguinLTG / @tpenguinltg

11/25/2017 at 06:29PM

29
#12 - 村橋究理基M.Kuriki@北大 / @mkuriki_

08/14/2018 at 12:37AM

29
#13 - nickGPT / @nickandbro

08/27/2024 at 05:20AM

30
#14 - DHM / @DHM29978992

05/24/2018 at 02:00AM

36
#15 - Vincent COMBEY / @VincentCombey

11/25/2017 at 05:40PM

49
#16 - Benjamin Schindler / @beschindler

11/26/2017 at 07:56AM