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

280 active golfers, 1683 entries

Leaderboard (lowest score wins):
16
#31 - Petro Тrouq / @zulolosi

08/05/2024 at 03:11PM

16
#32 - John Lee / @PromethiumL

08/10/2024 at 02:53PM

16
#33 - nickGPT / @nickandbro

08/14/2024 at 07:04AM

16
#34 - Higluos / @Higluos

08/14/2024 at 11:17AM

16
#35 - Yusuke Sakai / @n-mhn

08/16/2024 at 04:24AM

16
#36 - George Granberry / @ggranberry

08/16/2024 at 07:52PM

16
#37 - HenryBarbar / @HenryDerBarbar

08/19/2024 at 07:37PM

16
#38 - Suhaib Murshid / @suhaibm

08/21/2024 at 01:57PM

16
#39 - Karim / @KarimIbrahim

08/21/2024 at 09:15PM

16
#40 - Josh Cummings / @joshcummingsdesign

08/22/2024 at 11:38PM

16
#41 - shenyfg / @shenyfg

08/29/2024 at 02:29AM

16
#42 - Joel Eriksson / @OwariDa

04/08/2025 at 04:56AM

17
#43 - rhasarub / @rhasarub

09/05/2024 at 10:00AM

17
#44 - elforeee / @elforeee

10/02/2024 at 10:05AM

17
#45 - Andrew / @a0di

10/31/2024 at 10:48AM

17
#46 - k1mosabe / @k1mosabe

12/03/2024 at 06:06AM

17
#47 - Eng. José Esteves / @JGEsteves89

02/15/2025 at 09:58PM

17
#48 - 好家伙! / @xdudna

05/29/2025 at 08:02AM

17
#49 - djheidihoe / @djheidihoe1

10/13/2025 at 05:46PM

18
#50 - Meya / @meya-zhao

08/17/2024 at 12:04PM

18
#51 - Viktor Milosavljevic / @NoncommissionedRush

08/17/2024 at 05:18PM

18
#52 - Anton / @Sobes76rus

08/25/2024 at 06:08PM

18
#53 - Navid Salehi / @havijs

08/26/2024 at 09:10PM

18
#54 - penguinwithpants / @penguinwithpants

08/27/2024 at 08:18PM

18
#55 - John Huynh / @huynh_j93

08/29/2024 at 03:47PM

18
#56 - Neix20 / @Neix20

10/02/2024 at 08:47AM

18
#57 - dczmer / @dczmer

11/06/2024 at 12:20AM

19
#58 - Blake Raymond / @bit-ray

07/20/2024 at 07:32AM

19
#59 - Giacomo Sansone / @pcineverdies

07/20/2024 at 02:07PM

19
#60 - Valacar / @valacar

07/22/2024 at 11:53PM