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 348 remaining solutions by signing in and submitting your own entry
#349 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

349 active golfers, 1140 entries

Leaderboard (lowest score wins):
48
#211 - sjatkinson / @sjatkinson

08/29/2011 at 07:49PM

48
#212 - Simon Scarfe / @simonscarfe

08/30/2011 at 03:13PM

48
#213 - jasper110 / @jasper110

09/21/2011 at 05:19PM

48
#214 - Jon Keating / @emostar

11/02/2011 at 06:20AM

48
#215 - vimja / @vimja666

11/04/2011 at 11:25PM

48
#216 - Daniel Cohen / @danielissimo

02/08/2012 at 04:16PM

48
#217 - ise0615 / @ise0615

05/04/2012 at 05:01PM

48
#218 - Kevin McGladdery / @run_kmc

08/12/2012 at 08:35PM

48
#219 - うえっち / @uh_tomo

12/04/2012 at 04:44PM

48
#220 - Sheng / @shenghis

08/26/2013 at 06:32AM

48
#221 - Sam Unicomb / @samuelunicomb

01/21/2023 at 02:00PM

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

01/12/2024 at 02:01PM

48
#223 - Jean Dubois / @jd-develop

05/11/2025 at 04:15PM

49
#224 - Matt Garrett / @matthewgarrett

12/28/2010 at 10:18PM

49
#225 - Rune Botten / @runeb

12/31/2010 at 03:10PM

49
#226 - Francisco Dibar / @frandibar

01/11/2011 at 05:08AM

49
#227 - Pete Johns / @johnsyweb

01/15/2011 at 02:42AM

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

01/15/2011 at 08:03PM

49
#229 - Solomon White / @rubysolo

02/08/2011 at 05:09PM

49
#230 - Emile Swarts / @EmileSwarts

05/30/2011 at 10:10AM

49
#231 - demon.mhm / @demonmhm

02/28/2012 at 09:12PM

49
#232 - Timothy Caraballo / @openback

02/22/2013 at 07:24PM

49
#233 - Martin Sander / @0x89

03/08/2013 at 02:04PM

49
#234 - Kuldeep Bora / @kuldeep_bora

04/18/2013 at 05:18PM

49
#235 - James / @Dronak

09/03/2013 at 11:34PM

49
#236 - Walker Boh / @walker_boh

11/04/2015 at 08:48AM

49
#237 - Jurica / @Jurica34581259

12/06/2018 at 04:03AM

49
#238 - Michael / @openemitter

12/27/2023 at 01:56AM

49
#239 - Mummahmi / @mummahmi96048

08/08/2024 at 06:25AM

49
#240 - Matthew Woelk / @MattWoelk

10/24/2025 at 03:07PM