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 5675405ac5936f0ba3000002

Create bison tokens

Create tokens for bison out of a known list of words

Start file
call real integer write read while end do if then else program var begin return include
End file
call {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Call;
}
real {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Real;
}
integer {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Integer;
}
write {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Write;
}
read {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Read;
}
while {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return While;
}
end {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return End;
}
do {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Do;
}
if {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return If;
}
then {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Then;
}
else {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Else;
}
program {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Program;
}
var {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Var;
}
begin {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Begin;
}
return {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Return;
}
include {
	yylval.type = strdup("res");
	yylval.value = strdup(yytext);
	return Include;
}

View Diff

1c1,80
< call real integer write read while end do if then else program var begin return include
---
> call {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Call;
> }
> real {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Real;
> }
> integer {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Integer;
> }
> write {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Write;
> }
> read {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Read;
> }
> while {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return While;
> }
> end {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return End;
> }
> do {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Do;
> }
> if {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return If;
> }
> then {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Then;
> }
> else {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Else;
> }
> program {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Program;
> }
> var {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Var;
> }
> begin {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Begin;
> }
> return {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Return;
> }
> include {
> 	yylval.type = strdup("res");
> 	yylval.value = strdup(yytext);
> 	return Include;
> }

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 11 remaining solutions by signing in and submitting your own entry
#12 Håken Lid / haakenlid - Score: 115 - 12/27/15 @ 15:06
qayewi[<BS>{<CR>}<CR><Esc>kko<Tab>return <C-R>0;<Esc>B~ko<Tab>yylval <BS>.type = strdup("res");<Esc>yypftcwvalue<Esc>feci)yytext<Esc>3j0q15@add{uxddkkkkeae <Esc>ZZ

0 comments

#13 Christopher Wells / ExcaliburZero_Z - Score: 116 - 12/20/15 @ 04:19
qawi{<CR><Tab>yylval.type = strdup("res");<CR><BS><Esc><Up>yyp2wdeivalue<Esc>4w<Left>5xiyytext<Esc>2<Up>bvey2<Down>oreturn <Esc>pa;<Esc>b~o<BS>}<Esc><Down>q15@add<Up>2weae<Esc>3<Up>ie <Esc>ZZ

0 comments

#14 Alexander Botticelli / BotticelliAlex - Score: 125 - 12/19/15 @ 11:49
q2wi<CR><Esc>kA{<CR><Tab>yylval.type = strdup("res");<Esc>yypwwciwvalue<Esc>4wci(yytr<BS>ext<Esc>kkbviwy2jA<CR>return ;<Esc>Pb~A<CR>}<Esc>i<BS><Esc>jq@<Esc>15@2ddkA<BS>e;<Esc>kkkie <Esc>:wq<CR>

0 comments

Created by: BotticelliAlex

14 active golfers, 30 entries

Leaderboard (lowest score wins):
85
#1 - Smylers / Smylers2

02/11/2016 at 02:44PM

85
#2 - Urtica dioica / udioica

01/12/2017 at 02:02AM

86
#3 - Jon Krause / jkrause314

12/21/2015 at 06:51PM

86
#4 - John Braxler / braxler

02/12/2016 at 07:02PM

89
#5 - sellerie schnitzel / sellerieschnitz

12/20/2015 at 05:26PM

89
#6 - Carlos A Henríquez Q / lagunex

03/13/2016 at 04:22PM

97
#7 - Walker Boh / walker_boh

12/21/2015 at 03:56PM

102
#8 - Mikael Saltzman / MikaelSaltzman

12/27/2015 at 03:18PM

103
#9 - RobertT / techrt2050

01/25/2016 at 03:57AM

105
#10 - Frederik Klama / fklama

01/27/2016 at 03:37PM

110
#11 - Tj / yrddy

03/02/2016 at 02:36AM

115
#12 - Håken Lid / haakenlid

12/27/2015 at 03:06PM

116
#13 - Christopher Wells / ExcaliburZero_Z

12/20/2015 at 04:19AM

125
#14 - Alexander Botticelli / BotticelliAlex

12/19/2015 at 11:49AM