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 9v00669b3ff1000000000303

Rearrange array to single level

The goal is to flatten the array into a single list and remove any empty elements.

Start file
[
    []  ,
    [''],
    ['0', '1', '2'],
    ['3', '4', '5'],
    ['6', '7'],
    ['8', '9'],
    ['']
]
End file
['', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '']

View Diff

1,9c1
< [
<     []  ,
<     [''],
<     ['0', '1', '2'],
<     ['3', '4', '5'],
<     ['6', '7'],
<     ['8', '9'],
<     ['']
< ]
---
> ['', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '']

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 246 remaining solutions by signing in and submitting your own entry
#247 nockschii / @nockschii - Score: 670 - 08/20/24 @ 23:46
<Down><Down>lllllydy<Esc><Esc>kkl<C-A>Ap<BS><Esc>p<Esc>ppllklkjjkk<0xc3><0xb6><0xc3><0xb6><C-A>Ap<BS><Esc>pppp<Down><Down><Right><Right><Right><Right><Right>v<Right><Right>y<Up><Up><Right>p<Down><Down><Up><Down>dd<Up><Up>,i,<Left>l<BS><Esc>lljjlljhkvlllykkpuhpklkjjd<Esc>hhhxxxxxvllllyvlllldoo<BS>u<Esc>ukkllljkhpkjjhvhhhhyxxxxxxkkllllllllp<BS>xo<BS>hhh<BS><BS><BS>jj<BS><BS>h<BS>j<BS><Esc>jl<Esc>ljkkhhp<BS>xlljlkh <0xc3><0x84>x<Esc><Esc>i<0xc3><0x84><BS><BS>'2',jj<BS><BS><Esc>jjjhhhhhhhvhhhhylvllldkkkllllllllllpjjjjkhhhhhhhhhvlllpuvllly3vykkk<0xc3><0xb6>lllllllllllllpllllllllxlkkjjjjddjlk3vykkklkeeeeeeeeeeeepkkjjjjjjjkkddklkjj<0xc3><0xb6>jlk3vyddlkkkkkeeeeeeeeeeeeeeekeehxd<Esc>pppp<Esc>p<BS><BS><BS><BS>xxxxx<0xc3><0xa4>A<0xc3><0x84><BS><BS>A<BS>'9<BS>8<0xc3><0x84><BS><BS>',m<BS>'9<0xc3><0x84>'<BS><BS><BS>']h<BS>kk<BS><BS><Esc>kkjjjjjvj<Esc>klllll2vp<Esc>u2vyddkkkddddddddddkeeeA<Esc>p<BS>p<BS><Down>x<Down>xx<Esc>xx<Up>dddd<Up>eeeeeeeeeeeeeeeeeeeeeeeeeeeee,<Esc><Esc>i,<0xc3><0x84><0xc3><0x84><BS><BS><BS><BS> ''<Esc>aa<BS>B<BS><Esc>BBBBBB<0xc3><0xb6><0xc3><0xb6>lllli <Esc>llllli ll<BS><BS><Esc>llllli l<BS><Esc>llllli <Esc>llllli <Esc>wewewewei<Esc>  jhi e<BS><Esc>eeeeeei <Esc>eeeehhllhi <Esc>:wq<CR>

0 comments


Created by: @maharba6

247 active golfers, 1495 entries

Leaderboard (lowest score wins):
29
#151 - samuel erlands / @ErlandsSam52210

08/27/2024 at 06:53AM

29
#152 - Luke Terheyden / @terheyden

08/31/2024 at 03:56AM

30
#153 - Ben Gadbois / @bengadbois

08/08/2024 at 08:49PM

30
#154 - BlockLune / @BlockLune

08/10/2024 at 03:40AM

30
#155 - Zhang Yang / @DimLight1998

09/06/2024 at 03:59AM

30
#156 - ばやし / @shin5884_kt

09/08/2024 at 03:00PM

30
#157 - Josh / @joshfelm

05/02/2025 at 10:51AM

31
#158 - sg-hk / @sg-hk

08/16/2024 at 02:03PM

31
#159 - Max Strootmann / @MaxStrootmann

08/26/2024 at 07:00PM

31
#160 - Alex Elarbee / @elarbee

09/21/2024 at 04:00PM

31
#161 - demouo / @demouo

11/04/2024 at 01:47PM

32
#162 - Abhinav D. / @decisivedevops

08/02/2024 at 09:07AM

32
#163 - aeha / @aeha_official

08/05/2024 at 11:27AM

32
#164 - martynas-sm / @martynas-sm

08/14/2024 at 04:14PM

32
#165 - Josh Pius / @josh-pius

08/23/2024 at 07:11PM

32
#166 - Elijah Smith / @theincompletedetective

08/25/2024 at 03:40PM

32
#167 - Conor Flynn / @conor-f

08/27/2024 at 08:54AM

32
#168 - Andrew Alkema / @andrewalkema

08/28/2024 at 06:59PM

32
#169 - Felix Pankratz / @panki27

08/29/2024 at 01:29PM

32
#170 - Maxime Delhaye / @friphazeph

03/28/2025 at 11:21AM

33
#171 - Chris Trombley / @ctrombley

08/09/2024 at 09:45PM

33
#172 - RCube-gh / @RCube-gh

08/13/2024 at 04:44AM

33
#173 - DarChan / @richvote

08/13/2024 at 05:14AM

33
#174 - RZMNR / @RZMNR

08/13/2024 at 02:23PM

33
#175 - Zafer Goksu / @zafergoksu

03/26/2025 at 11:28PM

34
#176 - Hemram Kumarapu / @H4-MM-3R

07/22/2024 at 11:45AM

34
#177 - Kevin Horvat / @horvatkevin

08/04/2024 at 04:27PM

34
#178 - Mohammad Nasirifar / @farnasirim

08/18/2024 at 05:27PM

34
#179 - sleak wise / @SleakWise78883

08/28/2024 at 08:53AM

34
#180 - Jan Lukány / @lukany

03/08/2025 at 02:28PM