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

291 active golfers, 1742 entries

Leaderboard (lowest score wins):
14
#1 - Peppa Pig / @PeppaPigSg

08/28/2024 at 01:32PM

14
#2 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

08/28/2024 at 09:49PM

14
#3 - John Braxler / @braxler

09/03/2024 at 02:57PM

14
#4 - Stephen Edwards / @sventi555

09/04/2024 at 04:41PM

14
#5 - Reese / @figadore

09/17/2024 at 12:04AM

14
#6 - MatFriend / @MatFriend

09/24/2024 at 05:10AM

14
#7 - mtklar / @mtklar

10/19/2024 at 09:23AM

14
#8 - rasputins / @rasputins

10/23/2024 at 02:28AM

14
#9 - got_windy / @insomnight

10/24/2024 at 12:58AM

14
#10 - ARK / @ARezaK

10/28/2024 at 10:42PM

14
#11 - Rodi-Janssen / @Rodi-Janssen

11/06/2024 at 09:07AM

14
#12 - yexia0 / @yexia0

01/04/2025 at 09:10AM

14
#13 - Nathan Priego / @nspriego

03/06/2025 at 04:35AM

14
#14 - Alex Lewin / @_AlexLewin

04/23/2025 at 11:55PM

14
#15 - patrickmartinasin / @patrickmartinasin

04/28/2025 at 10:24PM

14
#16 - qorwlf218 / @qorwlf218

07/23/2025 at 11:08AM

14
#17 - Berel94 / @Berel94

10/20/2025 at 08:12PM

14
#18 - Aly Thobani / @alythobani

11/24/2025 at 05:53PM

14
#19 - Gavin / @GavinKoeng

12/11/2025 at 07:58AM

14
#20 - lassion / @mutilator630

01/16/2026 at 08:23AM

15
#21 - Alisenai / @alisenai

08/28/2024 at 10:03AM

15
#22 - ingonerd / @ingonerd

09/02/2024 at 07:22AM

15
#23 - Pim / @Pireax

11/08/2024 at 01:51AM

15
#24 - MirianGeronimo / @MirianGeronimo

12/05/2024 at 02:04AM

15
#25 - jimmymills / @jimmymills

05/15/2025 at 11:25PM

15
#26 - Gianluca Towae / @GianlucaTowae

05/22/2025 at 01:22PM

15
#27 - winter-loo / @winter-loo

06/22/2025 at 02:25PM

15
#28 - kloir-z / @kloir-z

01/16/2026 at 01:05AM

15
#29 - phix / @phix-42

01/26/2026 at 06:04AM

16
#30 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 06:50PM