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

307 active golfers, 1815 entries

Leaderboard (lowest score wins):
53
#271 - Hakan Ates / @ateshakan

08/25/2024 at 02:27PM

53
#272 - Brian Curless / @bwcurless

02/12/2025 at 07:13PM

53
#273 - Dan Moldovan / @dan12mol

07/03/2025 at 01:51PM

54
#274 - Antonio Cormoranes / @anonymous_joe

07/24/2024 at 09:14PM

55
#275 - Stanley_233 / @Stanley-233

04/03/2026 at 10:21AM

56
#276 - Farouq Aldori / @farouqaldori

08/05/2024 at 07:59PM

56
#277 - Breemskin / @Breemskin

07/25/2025 at 08:59PM

58
#278 - SRINIVASU SALADI / @SRINIVASUS22587

03/29/2025 at 09:36AM

59
#279 - Pablo Acuna / @pacuna

08/27/2024 at 10:39PM

59
#280 - Nikolas Tan / @oihv

04/14/2025 at 06:33AM

62
#281 - ishsonya / @ishsonya

01/31/2025 at 01:11PM

65
#282 - Romain Baumier / @rbaumier

08/24/2024 at 08:27AM

65
#283 - ahenches / @ahenches

02/25/2025 at 09:36PM

65
#284 - Martin Schlecker / @matiscke

08/28/2025 at 01:27PM

69
#285 - diwa / @LuoDi-Nate

04/29/2025 at 08:33AM

75
#286 - Martin Knoller Stocker / @linuxswords

07/10/2025 at 03:31PM

78
#287 - migoohao / @migoohao

06/23/2025 at 01:10PM

80
#288 - ProGamerYeet / @ProGamerYeet

10/09/2024 at 08:05PM

85
#289 - Benjamin Clauss / @benjaminclauss

07/28/2024 at 08:37PM

92
#290 - Josh Simmons / @Jsimmons--dev

02/07/2025 at 06:09PM

98
#291 - mindwrapped / @mindwrapped

08/23/2024 at 06:32PM

100
#292 - Fredrik Lundström / @Flundrahn

07/30/2024 at 11:11PM

102
#293 - Awab Rhamtallah / @awabrh

08/09/2024 at 06:50PM

104
#294 - Zhuosong Zhang / @zhuosongz

08/19/2024 at 09:48PM

104
#295 - Mustafa / @Mustafa-code-95

06/17/2026 at 04:00PM

130
#296 - Murphy / @TemplateXu

08/18/2024 at 05:58AM

131
#297 - Adrian / @adrian-abit

08/20/2024 at 11:12AM

131
#298 - AJ / @ajw109

04/05/2025 at 07:19PM

139
#299 - Yi-Ren Liu / @cart0909

08/06/2024 at 07:13AM

157
#300 - Marat / @Markizoid

10/11/2024 at 08:30AM