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 by @KaizenSoze70:

Unlock 7 remaining solutions by signing in and submitting your own entry
Created by: @VincentCombey

16 active golfers, 43 entries

Solutions by @KaizenSoze70:
22
#3 - Ben Hill / @KaizenSoze70

12/01/2017 at 03:17PM

26
#>8 - Ben Hill / @KaizenSoze70

11/27/2017 at 06:07PM

27
#>9 - Ben Hill / @KaizenSoze70

11/27/2017 at 05:49PM

27
#>9 - Ben Hill / @KaizenSoze70

11/27/2017 at 06:04PM

29
#>11 - Ben Hill / @KaizenSoze70

11/27/2017 at 05:43PM

31
#>14 - Ben Hill / @KaizenSoze70

11/27/2017 at 05:40PM

32
#>14 - Ben Hill / @KaizenSoze70

11/27/2017 at 05:32PM