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 4d1a522ea860b7447200010b

Braces or Brackets?

Someone forgot whether to use braces or brackets and you have to clean up their code!

Start file
var some_function = function {arg1, arg2} [
	var some_array = (1, 2, 3, 4, 'foo');
	for {var i in some_array} (
		console.log(some_array, [{1 + (8 / 2)}, 'hello (world)');
	)
];
End file
var some_function = function (arg1, arg2) {
	var some_array = [1, 2, 3, 4, 'foo'];
	for (var i in some_array) {
		console.log(some_array, [(1 + (8 / 2)), 'hello (world)');
	}
};

View Diff

1,6c1,6
< var some_function = function {arg1, arg2} [
<       var some_array = (1, 2, 3, 4, 'foo');
<       for {var i in some_array} (
<               console.log(some_array, [{1 + (8 / 2)}, 'hello (world)');
<       )
< ];
---
> var some_function = function (arg1, arg2) {
>       var some_array = [1, 2, 3, 4, 'foo'];
>       for (var i in some_array) {
>               console.log(some_array, [(1 + (8 / 2)), 'hello (world)');
>       }
> };

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 252 remaining solutions by signing in and submitting your own entry
#253 Ed Gibbs / @edward_gibbs - Score: 188 - 08/15/11 @ 05:15
wwwwr(wwwwr)wr[wwwwr[wwwwwwwwwwww<Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Up><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>r]wwr(wwwwww<Left><Left>r)wr{wwwwwww<Right>r(wwwwwww<Right>r)wwwwwwr}<Up><Up><Up><Up><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>r{<Down><Down><Down><Down><Down><Down><Down><Down><Left>r}<Esc>:w<CR>:q<CR>

0 comments


Created by: @sabiddle

253 active golfers, 710 entries

Leaderboard (lowest score wins):
68
#241 - Jon Ferrer / @jonnyheadphones

12/29/2010 at 10:11PM

69
#242 - Matthew Kirk / @mjkirk

12/29/2010 at 12:19AM

69
#243 - Oliver Christ / @0liverChrist

09/30/2013 at 09:08PM

72
#244 - Jonathan Perret / @jonathanperret

12/28/2010 at 09:21PM

72
#245 - Korbinian Stoemmer / @PaulSmecker

03/08/2013 at 02:08PM

76
#246 - Jakob k. Hansen / @JakobkHansen1

04/17/2022 at 11:56AM

82
#247 - Михаил Минков / @_x10

09/15/2011 at 02:42PM

83
#248 - Jeremy Johnstone / @jsjohnst

12/29/2010 at 10:13AM

84
#249 - R / @7vies

07/18/2011 at 12:11AM

107
#250 - David / @ddddddddavid

12/30/2010 at 04:38AM

112
#251 - Zhao Yao / @Lynch8080

12/31/2010 at 05:38PM

128
#252 - neleai / @enlaei

12/31/2010 at 10:04PM

188
#253 - Ed Gibbs / @edward_gibbs

08/15/2011 at 05:15AM