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

282 active golfers, 1687 entries

Leaderboard (lowest score wins):
27
#151 - skewcy / @ChuanyuXue

08/08/2024 at 03:07AM

27
#152 - Petr Hodač / @PetrHodac

08/29/2024 at 02:53PM

27
#153 - Fionn Fitzmaurice / @fionn

08/29/2024 at 06:19PM

27
#154 - Willy / @Willy6932612311

09/03/2024 at 08:45PM

27
#155 - Adam Campbell / @adamjcampbell

09/25/2024 at 02:37AM

27
#156 - Sutter099 / @Sutter099

10/08/2024 at 01:06PM

27
#157 - Dani Bengl / @cb341

12/22/2025 at 10:06PM

28
#158 - AlexSolisBullfinch / @AlexSolisBullfi

07/22/2024 at 04:22AM

28
#159 - Stanley F / @sfo

07/30/2024 at 07:02AM

28
#160 - Rayan Ali SALEM / @VKWHM

08/01/2024 at 04:41PM

28
#161 - heog / @Heogy

08/14/2024 at 09:11AM

28
#162 - Jay Mody / @jaymody

10/23/2024 at 12:54AM

28
#163 - JohanNorberg / @JohanNorberg

01/25/2025 at 04:08PM

28
#164 - FabusLuebbus / @FabusLuebbus

04/24/2025 at 06:24PM

28
#165 - Setkias / @Setkias

08/05/2025 at 09:21PM

29
#166 - drzbida / @drzbida

08/06/2024 at 09:54PM

29
#167 - muhahm / @muhahm263029

08/10/2024 at 06:17AM

29
#168 - Jonathan Holvey / @JonathanHolvey

08/21/2024 at 01:43AM

29
#169 - samuel erlands / @ErlandsSam52210

08/27/2024 at 06:53AM

29
#170 - Luke Terheyden / @terheyden

08/31/2024 at 03:56AM

29
#171 - casper / @casperrr

12/27/2025 at 09:53PM

30
#172 - Ben Gadbois / @bengadbois

08/08/2024 at 08:49PM

30
#173 - BlockLune / @BlockLune

08/10/2024 at 03:40AM

30
#174 - Zhang Yang / @DimLight1998

09/06/2024 at 03:59AM

30
#175 - ばやし / @shin5884_kt

09/08/2024 at 03:00PM

30
#176 - Josh / @joshfelm

05/02/2025 at 10:51AM

30
#177 - Will Powers / @wpowers42

08/09/2025 at 08:37PM

30
#178 - Martin Harvan / @martinhrvn

10/31/2025 at 09:35PM

30
#179 - Matthew Kanarick / @AwakeMeerkat

12/17/2025 at 07:26PM

31
#180 - sg-hk / @sg-hk

08/16/2024 at 02:03PM