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):
42
#121 - Wesley Wong / @wesleymwwong

01/29/2011 at 08:37AM

42
#122 - icdark / @icdark

05/29/2011 at 11:05PM

42
#123 - Jason Then / @racc69

08/08/2011 at 04:22AM

42
#124 - Dave Bradford / @dbradf

10/12/2011 at 05:58PM

42
#125 - David Pflug / @dpflug

05/17/2012 at 10:04PM

42
#126 - ineb / @ineb0

08/22/2012 at 11:52AM

42
#127 - Daniel / @Daniel00288663

04/03/2017 at 09:40AM

42
#128 - Zach Lapidus / @zach_lapidus

05/25/2021 at 01:34AM

42
#129 - Hugh / @deeoh22

12/12/2022 at 02:17PM

42
#130 - Qishuai Liu / @LiuQishuai

01/09/2023 at 11:17AM

42
#131 - TheOdd / @TheOdd

02/12/2024 at 07:58PM

42
#132 - iantalks / @iantalks

11/28/2024 at 01:28PM

43
#133 - Mike Plotz / @antisuji

12/30/2010 at 03:01AM

43
#134 - fukamikaze / @fukamikaze

01/01/2011 at 05:00AM

43
#135 - David Lam / @lamdk

01/02/2011 at 09:45AM

43
#136 - xhtmlforum / @xhtmlforum

01/31/2011 at 08:15PM

43
#137 - Mike Marion / @mikejmarion

03/21/2011 at 08:21AM

43
#138 - dtennant / @dtennant

06/24/2011 at 04:18PM

43
#139 - Jon Olin / @8BitTree

01/03/2012 at 06:33AM

43
#140 - Tom Sisk / @TomSisk

07/05/2012 at 08:13PM

43
#141 - Darcy Parker / @DarcyParker

10/16/2012 at 04:15PM

43
#142 - Liam Thurston / @lthurston188

08/18/2015 at 06:37AM

43
#143 - Jakob / @jajob

01/09/2017 at 07:36AM

43
#144 - Golf Vim / @GolfVim11388

06/30/2023 at 09:28PM

43
#145 - Brando / @brandonce

01/10/2025 at 09:04AM

44
#146 - kana / @kana1

12/29/2010 at 07:09PM

44
#147 - Behnam Esfahbod / @zwnj

12/31/2010 at 01:51PM

44
#148 - Jarkko Laine / @jarkko

01/02/2011 at 09:47AM

44
#149 - Fer Enaf / @0x00C0FFEE

01/05/2011 at 10:42AM

44
#150 - Tom Duijf / @tomduijf

02/12/2011 at 12:12PM