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 323 remaining solutions by signing in and submitting your own entry
#324 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

324 active golfers, 1054 entries

Leaderboard (lowest score wins):
44
#151 - Alex Croteau-Pothier / @AlexCP_

02/06/2012 at 08:15PM

44
#152 - Aaron Lake / @aaronmlake

02/28/2012 at 07:29PM

44
#153 - Nick Miller / @ItsMeNickMiller

08/21/2012 at 05:39PM

44
#154 - Kenneth Waters / @gen_witt

11/13/2012 at 07:49PM

44
#155 - Dmytro Dzhulgakov / @dzhulgakov

04/28/2013 at 08:56PM

44
#156 - CJ Avilla / @cjav_dev

05/11/2014 at 12:03AM

44
#157 - muhahm / @muhahm263029

08/09/2024 at 01:14AM

45
#158 - Olivier El Mekki / @oelmekki

12/28/2010 at 09:45PM

45
#159 - yossarian / @metaph0x

12/29/2010 at 08:28AM

45
#160 - Balkoth / @_Balkoth_

01/01/2011 at 01:15AM

45
#161 - Rörd Hinrichsen / @roerdhh

01/09/2011 at 11:01PM

45
#162 - Ivan Evtukhovich / @evtuhovich

07/29/2011 at 04:14PM

45
#163 - MONOLITH / @Compulith

01/31/2012 at 08:39AM

45
#164 - Kristopher Urie / @kristopherurie

02/11/2012 at 05:24AM

45
#165 - cj / @cj01101

08/17/2013 at 07:28PM

45
#166 - wihinenh / @wihinenh

04/18/2024 at 12:20PM

46
#167 - Henrik Nyh / @henrik

12/31/2010 at 03:30PM

46
#168 - iushdmfsdfn / @iushdmfsdfn

06/10/2011 at 10:36AM

46
#169 - Martin Janiczek / @janiczek

10/16/2011 at 11:48PM

46
#170 - Nolen Royalty / @NolenRoyalty

04/21/2012 at 02:03AM

46
#171 - Jouke-Thiemo Waleson / @jtwaleson

11/08/2012 at 08:29PM

46
#172 - BZ_VG / @BZ_VG

11/13/2012 at 09:22AM

46
#173 - Adam Bell / @adamgbell

03/27/2013 at 01:35AM

46
#174 - Tyler / @tylerbindon

03/31/2013 at 04:37AM

46
#175 - Eric Potter / @pottereric

06/07/2013 at 02:05PM

46
#176 - majo senf / @majo_senf

06/25/2019 at 01:20PM

46
#177 - Алексей Иванин / @AliakseiIvanin

11/10/2021 at 08:58AM

46
#178 - Tyler Carson / @tylerccarson

01/14/2022 at 11:17PM

46
#179 - Jayanth Koushik / @jayanthkoushik

07/10/2024 at 07:23AM

46
#180 - Diwakar Singh Parmar / @parmardiwakar150

08/27/2024 at 01:29PM