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):
54
#271 - TchiKong / @tchikong

01/29/2011 at 01:06PM

54
#272 - Gowtham Madhava / @gowthamgowtham

07/02/2012 at 04:52PM

54
#273 - Manuel Meilinger / @MMeilinger

03/08/2013 at 02:25PM

54
#274 - shahanavaz m / @shahanavazm

02/12/2022 at 04:59PM

54
#275 - KoroneListener / @KoroneListener

09/03/2024 at 06:03PM

54
#276 - jfdg01 / @jfdg01

10/20/2024 at 09:33AM

55
#277 - Fred Nias / @frednias

12/30/2010 at 11:37AM

55
#278 - Adelar S. Queiróz / @adelarsq

11/25/2012 at 01:26AM

55
#279 - René Scheibe / @renescheibe

03/08/2013 at 02:16PM

56
#280 - drio / @drio

12/29/2010 at 03:35PM

56
#281 - Son of Bongo / @bpcode

08/26/2012 at 03:32AM

56
#282 - Rob Grijs / @robgrijs

10/14/2012 at 04:00PM

56
#283 - Maurice Schmicking / @m_schmicking

03/31/2023 at 10:02PM

56
#284 - akashcapitalnumbers / @akashcapitalnumbers

12/25/2024 at 07:51PM

57
#285 - clint tseng / @cxlt

12/28/2010 at 09:28PM

57
#286 - Axl Waii / @axlwaii

08/26/2012 at 12:58PM

57
#287 - Milind Ganjoo / @mganjoo

01/25/2014 at 10:29PM

57
#288 - vimgolfer / @vimgolfer7

10/04/2019 at 05:00AM

58
#289 - aymeric-guth / @aymeric-guth

01/03/2024 at 10:59PM

60
#290 - Brandon Ferguson / @bnferguson

12/31/2010 at 10:26PM

60
#291 - Matt York / @yorkmatt

02/13/2012 at 06:54PM

60
#292 - roux g. buciu / @adudenamedruby

11/03/2024 at 11:55PM

62
#293 - Sean Wolfe / @swolfe

12/28/2010 at 10:09PM

62
#294 - wesrog / @wesrog

12/28/2010 at 10:20PM

62
#295 - Thibault Jouan / @tjouan

12/29/2010 at 10:34PM

62
#296 - 765859220 / @765859220

08/27/2024 at 08:28AM

63
#297 - Suhas V / @vhasus

04/15/2013 at 12:01PM

64
#298 - Aditya Singh / @0xaditya

08/24/2024 at 05:58AM

65
#299 - changling / @Lspacewalker

12/19/2011 at 07:45PM

65
#300 - Global Maquereau / @GlobalMaquereau

12/31/2012 at 10:54AM