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):
50
#241 - KarateSnoopy / @KarateSnoopy

08/12/2024 at 09:39AM

50
#242 - Henrik Lehtonen / @helehto

08/17/2024 at 11:28PM

50
#243 - Oleksii Sanin / @AlexSanin

12/07/2024 at 11:48AM

51
#244 - Andrey Tarantsov / @andreyvit

12/28/2010 at 10:10PM

51
#245 - Andrey A. Ugolnik / @andreyugolnik

01/19/2011 at 06:15PM

51
#246 - Thom Hughes / @thom_hughes_1

03/23/2011 at 02:43PM

51
#247 - drooooooooooo / @droooooooooooo

08/08/2011 at 02:19AM

51
#248 - Eric Weikl / @ericweikl

03/08/2013 at 02:14PM

51
#249 - Simon Tost / @Someone_Busy

03/08/2013 at 03:12PM

51
#250 - David Fonseca / @ddfonseca6

10/09/2016 at 12:56AM

51
#251 - Sean Cahill / @ess_jay_kay

11/01/2021 at 02:37PM

51
#252 - Zayn Yuan / @YuanDao1314

12/25/2022 at 03:33AM

51
#253 - coffee-addict / @o0ff3e6ddict

04/12/2023 at 08:37PM

51
#254 - 🥚 / @schmarles_

10/21/2024 at 09:30PM

52
#255 - Rob Ciaccio / @RobertoCalavera

01/16/2011 at 08:47AM

52
#256 - Craig H. Anderson / @CootCraig

04/18/2011 at 03:41PM

52
#257 - Mikhail Korepanov / @PanyaKor

06/13/2011 at 01:33PM

52
#258 - mnx / @mnxx

06/04/2012 at 09:59PM

52
#259 - Dave Ingram / @dmi

11/21/2012 at 06:31PM

52
#260 - くま ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้้้้ 55 / @kumack55

04/03/2013 at 12:07PM

52
#261 - RockerZZY / @rocker_zzy

06/25/2020 at 02:05AM

53
#262 - Dave / @zzdave13

08/02/2011 at 08:16PM

53
#263 - Daniel Harrington / @rubiii

12/10/2011 at 07:42PM

53
#264 - Bernhard Tausch / @tauschb

03/08/2013 at 02:13PM

53
#265 - Daniel / @Daniel55042385

01/12/2023 at 03:04PM

53
#266 - Aleksander Moiseenko / @therealalexmois

01/31/2024 at 05:14AM

53
#267 - Colin Benner / @yzhs

01/12/2025 at 08:22AM

54
#268 - alexscott / @4l3xsc0tt

12/30/2010 at 02:41AM

54
#269 - jacobangel / @jacobangel

12/31/2010 at 08:15AM

54
#270 - Dezső Zoltán / @zakiazigazi

01/22/2011 at 07:24AM