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):
34
#31 - Paul Molloy / @paulsmolloy

10/20/2023 at 05:45PM

34
#32 - Chris Atanasian / @chrisatanasian

11/17/2023 at 09:08PM

34
#33 - Simo Kivistö / @kivissimo

02/08/2024 at 07:01PM

34
#34 - Ilya Shakirov / @aelaau

03/11/2024 at 03:25PM

34
#35 - ck961018 / @ck961018

05/10/2024 at 11:32AM

34
#36 - Aly Thobani / @alythobani

05/26/2024 at 11:47PM

34
#37 - shannon / @ShannonGu1031

05/28/2024 at 06:15AM

34
#38 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:56PM

34
#39 - Peppa Pig / @PeppaPigSg

09/15/2024 at 12:31AM

34
#40 - Dan F. / @danielrfh

11/22/2024 at 11:11PM

34
#41 - xscript71 / @xscript71

11/26/2024 at 02:25PM

34
#42 - bounce114 / @bounce114

12/01/2024 at 06:10AM

34
#43 - interminable007 / @interminable007

01/03/2025 at 12:01PM

34
#44 - Peagol / @oscar1marte

02/10/2025 at 11:59AM

34
#45 - kevincking1986 / @kevincking1986

03/27/2025 at 12:20AM

35
#46 - Antony Scriven / @antonyscriven

02/06/2011 at 12:35PM

35
#47 - Junfeng / @junfeng

07/15/2011 at 07:53AM

35
#48 - Mihai / @mihaicristiant

02/04/2019 at 12:05PM

35
#49 - Lory / @Lory46845742

12/06/2019 at 01:20PM

35
#50 - Jean George / @JeanGeo20504212

03/21/2022 at 09:19PM

35
#51 - Александр Моисеев / @Aleksan43607471

01/20/2023 at 11:07AM

35
#52 - 吃鱼 / @xwwd9

02/02/2024 at 04:48AM

35
#53 - maxdarling / @maxdarling

02/03/2024 at 07:56PM

36
#54 - oliver mueller / @marcontwit

01/22/2012 at 08:08AM

36
#55 - Sofia Balicka / @so_phifi

03/20/2013 at 09:57AM

36
#56 - Petro Mudrievskyj / @petemud

06/28/2024 at 08:10AM

37
#57 - Ravil Bayramgalin / @brainopia

01/02/2011 at 04:57PM

37
#58 - Wei Dai / @clvv42

01/03/2011 at 02:04AM

37
#59 - Tim Dean / @Tmdean

01/05/2011 at 07:16PM

37
#60 - Ruy Diaz / @diazruy

03/11/2011 at 04:43AM