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):
40
#91 - William Dunand / @wdunand

12/13/2011 at 01:21AM

40
#92 - Ali Moeeny MD PhD / @alimoeeny

12/14/2011 at 08:16PM

40
#93 - Tara Bass / @tara_bass

12/31/2011 at 11:44PM

40
#94 - じょんあば / @john_ababa

02/22/2012 at 01:06PM

40
#95 - OMF / @exolon

05/28/2012 at 12:51AM

40
#96 - RobertT / @techrt2050

07/30/2013 at 10:42PM

40
#97 - brett / @brettyukich

09/22/2013 at 09:21AM

40
#98 - Daniel Marjenburgh / @dmarjenburgh

11/17/2013 at 12:03PM

40
#99 - Gurukandhamoorthi / @Gurukandhamoor1

07/22/2017 at 03:59PM

41
#100 - uuu / @uu59

12/29/2010 at 08:16PM

41
#101 - Ilya Strukov / @i1ey

05/01/2011 at 05:40PM

41
#102 - kjrn / @kjrnleto

05/22/2011 at 07:10PM

41
#103 - mightyfoo / @mightyfoo

05/25/2011 at 12:58PM

41
#104 - Adam Ransom / @voidgmr

12/23/2011 at 02:51PM

41
#105 - Peter Anselmo / @peter_anselmo

03/13/2012 at 01:32PM

41
#106 - vansan / @VinceVansan

08/21/2012 at 11:05AM

41
#107 - tmr / @tmr314

09/07/2012 at 12:23PM

41
#108 - Hubba / @HubbaBubbaFett

11/21/2012 at 09:00PM

41
#109 - Phillip David / @phrodod

12/22/2012 at 07:40AM

41
#110 - Sebastian Morr / @blinry

01/17/2013 at 11:32PM

41
#111 - Steve Tjoa / @stevetjoa

01/30/2013 at 07:41AM

41
#112 - Charlene Tshos / @charlymul

05/24/2013 at 06:23AM

41
#113 - Quota / @Quotad

02/10/2014 at 04:08PM

41
#114 - Joonas Pihlajamaa / @jokkebk

02/19/2014 at 03:21PM

41
#115 - Данил / @Danilkirienko81

06/29/2022 at 08:50AM

41
#116 - robit ultra lark / @RobitUltra

05/13/2023 at 12:20AM

41
#117 - Anton Savelyev / @PoiXP

01/03/2025 at 08:56PM

42
#118 - Steve Morrow / @yawmark

12/31/2010 at 09:07PM

42
#119 - Tim Chase / @gumnos

01/08/2011 at 03:40PM

42
#120 - Andrey Ivanov / @Bytamine

01/19/2011 at 05:01PM