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):
48
#211 - Sam Unicomb / @samuelunicomb

01/21/2023 at 02:00PM

48
#212 - 5S-BENDEGUZ-HORVATH / @5S-BENDEGUZ-HORVATH

01/12/2024 at 02:01PM

49
#213 - Matt Garrett / @matthewgarrett

12/28/2010 at 10:18PM

49
#214 - Rune Botten / @runeb

12/31/2010 at 03:10PM

49
#215 - Francisco Dibar / @frandibar

01/11/2011 at 05:08AM

49
#216 - Pete Johns / @johnsyweb

01/15/2011 at 02:42AM

49
#217 - Thomas Schönwälder / @Masei1988

01/15/2011 at 08:03PM

49
#218 - Solomon White / @rubysolo

02/08/2011 at 05:09PM

49
#219 - Emile Swarts / @EmileSwarts

05/30/2011 at 10:10AM

49
#220 - demon.mhm / @demonmhm

02/28/2012 at 09:12PM

49
#221 - Timothy Caraballo / @openback

02/22/2013 at 07:24PM

49
#222 - Martin Sander / @0x89

03/08/2013 at 02:04PM

49
#223 - Kuldeep Bora / @kuldeep_bora

04/18/2013 at 05:18PM

49
#224 - James / @Dronak

09/03/2013 at 11:34PM

49
#225 - Walker Boh / @walker_boh

11/04/2015 at 08:48AM

49
#226 - Jurica / @Jurica34581259

12/06/2018 at 04:03AM

49
#227 - Michael / @openemitter

12/27/2023 at 01:56AM

49
#228 - Mummahmi / @mummahmi96048

08/08/2024 at 06:25AM

50
#229 - Cap / @cappy_haddock

12/29/2010 at 09:48AM

50
#230 - Roman Mašek / @romario333

01/04/2011 at 07:15AM

50
#231 - dave lyons / @loadedfingers

01/05/2011 at 10:32AM

50
#232 - Joost / @vlabakje

02/12/2011 at 12:10PM

50
#233 - Jam / @jam00_bcn

06/19/2011 at 01:59PM

50
#234 - Neil / @spameldoon

08/21/2011 at 12:57AM

50
#235 - nicolas bo / @thevegeta

11/09/2011 at 08:13AM

50
#236 - Sylvain / @20vinW

07/15/2012 at 09:44AM

50
#237 - Josh Johnson / @jnjosh

04/07/2013 at 03:27AM

50
#238 - Tyler Tesch / @TylerTesch

06/02/2013 at 05:04PM

50
#239 - Chenut Ludovic / @7Brwa7

03/30/2016 at 08:28PM

50
#240 - xiaoao1024 / @xiaoao1024

12/21/2023 at 06:35AM