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

344 active golfers, 1123 entries

Leaderboard (lowest score wins):
56
#301 - Elizabeth / @allofher

10/11/2025 at 05:08PM

57
#302 - clint tseng / @cxlt

12/28/2010 at 09:28PM

57
#303 - Axl Waii / @axlwaii

08/26/2012 at 12:58PM

57
#304 - Milind Ganjoo / @mganjoo

01/25/2014 at 10:29PM

57
#305 - vimgolfer / @vimgolfer7

10/04/2019 at 05:00AM

57
#306 - mf06359 / @mf06359

07/10/2025 at 04:41AM

57
#307 - Jurica Ivekovic-Pontoni / @Mithrulduin

08/05/2025 at 07:53PM

58
#308 - aymeric-guth / @aymeric-guth

01/03/2024 at 10:59PM

60
#309 - Brandon Ferguson / @bnferguson

12/31/2010 at 10:26PM

60
#310 - Matt York / @yorkmatt

02/13/2012 at 06:54PM

60
#311 - roux g. buciu / @adudenamedruby

11/03/2024 at 11:55PM

62
#312 - Sean Wolfe / @swolfe

12/28/2010 at 10:09PM

62
#313 - wesrog / @wesrog

12/28/2010 at 10:20PM

62
#314 - Thibault Jouan / @tjouan

12/29/2010 at 10:34PM

62
#315 - 765859220 / @765859220

08/27/2024 at 08:28AM

63
#316 - Suhas V / @vhasus

04/15/2013 at 12:01PM

64
#317 - Aditya Singh / @0xaditya

08/24/2024 at 05:58AM

65
#318 - changling / @Lspacewalker

12/19/2011 at 07:45PM

65
#319 - Global Maquereau / @GlobalMaquereau

12/31/2012 at 10:54AM

66
#320 - Henri Bourcereau / @mmai

12/30/2010 at 01:36PM

66
#321 - Stanley Gao / @gaosu2718

03/21/2025 at 02:31PM

67
#322 - Chris Parsons / @chrismdp

12/28/2010 at 10:49PM

68
#323 - Jon Ferrer / @jonnyheadphones

12/29/2010 at 10:11PM

68
#324 - Afzal Hussain / @afzalhussain23

04/10/2024 at 01:28PM

69
#325 - Matthew Kirk / @mjkirk

12/29/2010 at 12:19AM

69
#326 - Oliver Christ / @0liverChrist

09/30/2013 at 09:08PM

72
#327 - Jonathan Perret / @jonathanperret

12/28/2010 at 09:21PM

72
#328 - Korbinian Stoemmer / @PaulSmecker

03/08/2013 at 02:08PM

73
#329 - Ryo3110 / @r-3110

04/26/2025 at 05:46AM

76
#330 - Jakob k. Hansen / @JakobkHansen1

04/17/2022 at 11:56AM