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 348 remaining solutions by signing in and submitting your own entry
#349 biloute02 / @biloute02 - Score: 523 - 04/27/24 @ 12:16
<Esc>:g<BS>_<BS>+<BS>!@#$<BS><BS><BS><BS>&*()<BS><BS><BS><BS>()_+<BS><BS><BS><BS>1<BS>[]\<BS><BS>!<BS><BS>1<BS>[]\'{}|<BS><BS><BS><BS><BS><BS>_)(*&^%$#@!<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>+_)(*&^%$#@!<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>%^<BS><BS>%s<BS>s.<BS>/<Esc>xu:s?<BS><BS>gs<BS><BS>5<BS>%<BS>%s<CR>:mn<BS>an :s<CR>V<Esc>:,<BS>.f<BS><BS>s<BS>g<BS>k<BS>l<BS>hl<BS>elp :c<BS>s<CR><C-D><C-U><C-D><C-D><C-D><C-U><C-U><C-U><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-U><C-U>:hie<BS><BS>u<BS>f<BS>o<BS>l<BS>e<BS>elp range<CR>:%/{/[?<BS>/g<CR>q:<Up><Right>is<CR><Esc><Esc>:q<CR>q:<Up><Up><CR>:<Esc>s<Esc>uuq:<Up><Right><Right><Right><Right><Right>r0r)r(<CR>q:<Up><Right><Right><Right>r}llr)<CR>q:<Up><Right><Right><Right>r[llr{<CR>f<Esc>q:<Down><Up><Right><Right><Right>i><BS>?<BS>'|"<BS><BS><BS><><BS><BS>/?<BS><BS>M<<BS><BS>:;<BS><BS>"|'\<BS><BS><BS><BS><Esc>/<Esc><Esc><Right><Left><Right>i-++_<BS><BS><BS><BS>!@#$%^&*()+_)(<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>:?><MM,./;l'\]<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>\\|<BS><BS><Right><Right>|<BS>\<CR>q:<Up><Right><Right><Right><Right>r]lll]}r}<CR>klr}kkA<BS>}<BS>{<Esc>p<Esc>sk<BS><Esc>jllllllrslhrJr(<Up><Up><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>r[]<Esc>wwwwwweeeeehr]<Down><Down><Left><Left><Left>r[<Esc>:c<BS>x<CR>

0 comments


Created by: @sabiddle

349 active golfers, 1140 entries

Leaderboard (lowest score wins):
43
#151 - Jakob / @jajob

01/09/2017 at 07:36AM

43
#152 - Golf Vim / @GolfVim11388

06/30/2023 at 09:28PM

43
#153 - Brando / @brandonce

01/10/2025 at 09:04AM

44
#154 - kana / @kana1

12/29/2010 at 07:09PM

44
#155 - Behnam Esfahbod / @zwnj

12/31/2010 at 01:51PM

44
#156 - Jarkko Laine / @jarkko

01/02/2011 at 09:47AM

44
#157 - Fer Enaf / @0x00C0FFEE

01/05/2011 at 10:42AM

44
#158 - Tom Duijf / @tomduijf

02/12/2011 at 12:12PM

44
#159 - Alex Croteau-Pothier / @AlexCP_

02/06/2012 at 08:15PM

44
#160 - Aaron Lake / @aaronmlake

02/28/2012 at 07:29PM

44
#161 - Nick Miller / @ItsMeNickMiller

08/21/2012 at 05:39PM

44
#162 - Kenneth Waters / @gen_witt

11/13/2012 at 07:49PM

44
#163 - Dmytro Dzhulgakov / @dzhulgakov

04/28/2013 at 08:56PM

44
#164 - CJ Avilla / @cjav_dev

05/11/2014 at 12:03AM

44
#165 - muhahm / @muhahm263029

08/09/2024 at 01:14AM

44
#166 - Shea Martin / @sheam

01/27/2026 at 06:48PM

45
#167 - Olivier El Mekki / @oelmekki

12/28/2010 at 09:45PM

45
#168 - yossarian / @metaph0x

12/29/2010 at 08:28AM

45
#169 - Balkoth / @_Balkoth_

01/01/2011 at 01:15AM

45
#170 - Rörd Hinrichsen / @roerdhh

01/09/2011 at 11:01PM

45
#171 - Ivan Evtukhovich / @evtuhovich

07/29/2011 at 04:14PM

45
#172 - MONOLITH / @Compulith

01/31/2012 at 08:39AM

45
#173 - Kristopher Urie / @kristopherurie

02/11/2012 at 05:24AM

45
#174 - cj / @cj01101

08/17/2013 at 07:28PM

45
#175 - wihinenh / @wihinenh

04/18/2024 at 12:20PM

46
#176 - Henrik Nyh / @henrik

12/31/2010 at 03:30PM

46
#177 - iushdmfsdfn / @iushdmfsdfn

06/10/2011 at 10:36AM

46
#178 - Martin Janiczek / @janiczek

10/16/2011 at 11:48PM

46
#179 - Nolen Royalty / @NolenRoyalty

04/21/2012 at 02:03AM

46
#180 - Jouke-Thiemo Waleson / @jtwaleson

11/08/2012 at 08:29PM