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):
37
#61 - Terje Larsen / @terlars

05/12/2011 at 11:46AM

37
#62 - Pei-Lun Lee / @ypcatw

01/14/2012 at 04:00AM

37
#63 - Henry Johnes / @xeosvn

01/31/2012 at 01:05PM

37
#64 - Kerson Hsiao / @KersonHsiao

08/03/2012 at 03:12AM

37
#65 - Marcin Szamotulski / @me_coot

09/26/2012 at 08:27AM

37
#66 - David Barnett / @mu_mind

11/26/2012 at 10:30AM

37
#67 - igoodrich / @igoodrich

03/04/2013 at 06:49AM

37
#68 - Dimitar Dimitrov / @kurkale6ka

04/13/2016 at 01:17PM

37
#69 - 5S-LIVIUSZ-SZALMA / @5S-LIVIUSZ-SZALMA

01/12/2024 at 02:36PM

37
#70 - Pablo Acuna / @pacuna

10/22/2024 at 03:01AM

38
#71 - Justin Love / @wondible

06/08/2011 at 03:04PM

38
#72 - Lauri Tirkkonen / @lotheac

07/01/2011 at 10:43PM

38
#73 - Emeric Dupont / @stucule

08/23/2011 at 01:04PM

38
#74 - Jesús Espino / @jespinog

09/06/2011 at 08:31AM

38
#75 - You-Siang Lin / @yslinnctu

11/27/2011 at 05:08AM

38
#76 - Trevor Powell / @DoomedBunnies

11/29/2011 at 12:24AM

38
#77 - Zeh Rizzatti / @zehrizzatti

02/06/2012 at 01:46AM

38
#78 - M8R eonxi21 / @eonxi21

05/20/2013 at 08:19PM

38
#79 - jakeroberts / @jakeroberts

05/29/2017 at 02:37PM

38
#80 - DHM / @DHM29978992

04/30/2018 at 07:55PM

39
#81 - rabidpraxis / @rabidpraxis

01/22/2011 at 03:31AM

39
#82 - Xavier Nayrac / @lkdjiin

12/29/2011 at 01:58PM

39
#83 - drupalovereasy / @drupalovereasy

04/15/2012 at 02:12AM

39
#84 - Dom Armstrong / @dom_cycleface

09/12/2013 at 12:33PM

39
#85 - xiang / @xiang56002997

09/05/2023 at 10:40PM

39
#86 - Juan Pablo O - @pablospina@mastodon.social / @gnupablo

03/29/2024 at 07:44PM

39
#87 - Elliot Schemmel / @regulated

10/29/2024 at 08:04PM

40
#88 - wyl rof / @wylrof

01/11/2011 at 04:03PM

40
#89 - Clive Evans / @swish_bob

01/13/2011 at 08:26PM

40
#90 - Sergey Doroshenko / @dorserg

03/04/2011 at 09:48AM