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):
66
#301 - Henri Bourcereau / @mmai

12/30/2010 at 01:36PM

66
#302 - Stanley Gao / @gaosu2718

03/21/2025 at 02:31PM

67
#303 - Chris Parsons / @chrismdp

12/28/2010 at 10:49PM

68
#304 - Jon Ferrer / @jonnyheadphones

12/29/2010 at 10:11PM

68
#305 - Afzal Hussain / @afzalhussain23

04/10/2024 at 01:28PM

69
#306 - Matthew Kirk / @mjkirk

12/29/2010 at 12:19AM

69
#307 - Oliver Christ / @0liverChrist

09/30/2013 at 09:08PM

72
#308 - Jonathan Perret / @jonathanperret

12/28/2010 at 09:21PM

72
#309 - Korbinian Stoemmer / @PaulSmecker

03/08/2013 at 02:08PM

76
#310 - Jakob k. Hansen / @JakobkHansen1

04/17/2022 at 11:56AM

76
#311 - Macro / @Macro364860

08/07/2024 at 05:27AM

77
#312 - Michael Lisitsa / @michaellisitsa

02/16/2025 at 10:40AM

81
#313 - 5S-MOHAMED-SHABAIK / @5S-MOHAMED-SHABAIK

01/19/2024 at 11:29AM

82
#314 - Михаил Минков / @_x10

09/15/2011 at 02:42PM

83
#315 - Jeremy Johnstone / @jsjohnst

12/29/2010 at 10:13AM

84
#316 - R / @7vies

07/18/2011 at 12:11AM

92
#317 - Jacin Yan / @jacinyan

05/08/2024 at 12:45AM

107
#318 - David / @ddddddddavid

12/30/2010 at 04:38AM

112
#319 - Zhao Yao / @Lynch8080

12/31/2010 at 05:38PM

115
#320 - 5S-RAFI-FAISAL / @5S-RAFI-FAISAL

01/12/2024 at 02:32PM

128
#321 - neleai / @enlaei

12/31/2010 at 10:04PM

168
#322 - OsamaElkadeem / @OsamaElkadeem

08/17/2024 at 05:21PM

188
#323 - Ed Gibbs / @edward_gibbs

08/15/2011 at 05:15AM

523
#324 - biloute02 / @biloute02

04/27/2024 at 12:16PM