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):
47
#181 - Brad Grzesiak / @listrophy

12/28/2010 at 09:47PM

47
#182 - Matthieu Honel / @ocus

01/26/2011 at 08:44AM

47
#183 - Igor Saprykin / @saturdayigor

01/30/2012 at 02:43PM

47
#184 - matthew / @mdespuits

02/02/2012 at 07:45PM

47
#185 - Drew Benedetti / @cnorsl

02/16/2012 at 10:49PM

47
#186 - mwatkward / @AftrschoolSpe

06/25/2012 at 07:55PM

47
#187 - Mikko Loponen / @lopossumi

10/22/2012 at 07:21PM

47
#188 - Lieven Keersmaekers / @LievenKeersmaek

12/02/2012 at 07:23PM

47
#189 - yohe / @yohe_0616

12/23/2012 at 08:35AM

47
#190 - foo / @foo88832727

10/18/2013 at 06:23PM

47
#191 - anonymouse / @anonymo65837183

03/12/2022 at 09:34PM

47
#192 - vuems / @vuems2win

11/26/2022 at 08:21PM

47
#193 - satake0916 / @satake0916

01/21/2024 at 01:33AM

48
#194 - Shawn Tice / @shtice

12/29/2010 at 12:15AM

48
#195 - Simon Edwardsson / @_SimEdw_

12/29/2010 at 05:23PM

48
#196 - Amir Hedayaty / @hedayaty

12/31/2010 at 02:35PM

48
#197 - Eivind Jahren / @HaskellElephant

01/15/2011 at 11:20PM

48
#198 - Derrick Camerino / @robustdj

04/20/2011 at 11:26PM

48
#199 - Masashi Iizuka / @uochan

04/24/2011 at 07:40AM

48
#200 - Daniel Stoza / @dstoza

08/29/2011 at 02:32AM

48
#201 - sjatkinson / @sjatkinson

08/29/2011 at 07:49PM

48
#202 - Simon Scarfe / @simonscarfe

08/30/2011 at 03:13PM

48
#203 - jasper110 / @jasper110

09/21/2011 at 05:19PM

48
#204 - Jon Keating / @emostar

11/02/2011 at 06:20AM

48
#205 - vimja / @vimja666

11/04/2011 at 11:25PM

48
#206 - Daniel Cohen / @danielissimo

02/08/2012 at 04:16PM

48
#207 - ise0615 / @ise0615

05/04/2012 at 05:01PM

48
#208 - Kevin McGladdery / @run_kmc

08/12/2012 at 08:35PM

48
#209 - うえっち / @uh_tomo

12/04/2012 at 04:44PM

48
#210 - Sheng / @shenghis

08/26/2013 at 06:32AM