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

254 active golfers, 1528 entries

Leaderboard (lowest score wins):
19
#61 - Eric Söderström / @eksoderstrom

08/12/2024 at 04:22PM

19
#62 - Irell Zane / @Zane-dev16

08/14/2024 at 08:41PM

19
#63 - Hector Bjernersjö / @HectorBjernersjo

08/15/2024 at 05:09PM

19
#64 - tbjep / @tbjep

08/28/2024 at 10:35AM

19
#65 - Christopher Arausa | Rathma / @wrathofrathma

08/28/2024 at 05:13PM

19
#66 - MartnRamtin / @MartnRamtin

09/01/2024 at 08:34PM

19
#67 - Adi / @adi2004

09/29/2024 at 08:15PM

20
#68 - Kevin Lou / @klou23

07/26/2024 at 04:42PM

20
#69 - Maximilian Ballard / @ediw8311xht

08/04/2024 at 11:29PM

20
#70 - Sam / @44100hertz

08/17/2024 at 05:21AM

20
#71 - tobi256 / @tobi256

08/21/2024 at 06:12PM

20
#72 - Jamie-505 / @Jamie-505

09/10/2024 at 10:10PM

20
#73 - Janusz Spatz / @janusz-anue

09/14/2024 at 08:41PM

20
#74 - aaay-aaay / @aaay-aaay

10/27/2024 at 09:16PM

20
#75 - SnakitoGamer4160 / @SnakitoGamer4160

11/08/2024 at 10:56PM

21
#76 - Namdrib / @Namdrib

07/21/2024 at 11:33AM

21
#77 - Michael / @thscuriousquest

07/21/2024 at 09:02PM

21
#78 - ShookerAndBeta / @Shooker2012

07/24/2024 at 02:05AM

21
#79 - Patrick / @TIisWack

08/02/2024 at 09:39PM

21
#80 - Alex Khakhlyuk / @khakhlyuk

08/21/2024 at 02:20PM

21
#81 - Prem Netsuwan / @grnnja

08/27/2024 at 04:27PM

21
#82 - Евгений Шевченко / @3530385

09/03/2024 at 03:52AM

21
#83 - Håkon Anders Strømsodd / @haakon8855

09/23/2024 at 09:59AM

21
#84 - danmccaffrey / @danmccaffrey

05/14/2025 at 08:15PM

21
#85 - 0xf00ff00f / @0xf00ff00f

06/17/2025 at 11:35PM

22
#86 - ericlovesmath / @ericlovesmath

08/09/2024 at 07:59PM

22
#87 - TimMcGuire / @mcguire

08/16/2024 at 02:44PM

22
#88 - Joel Williams / @10WilliamsJoel

09/05/2024 at 10:56AM

22
#89 - mirroris / @mirroris

12/16/2024 at 06:38PM

23
#90 - HAYASHI-Masayuki / @HAYASHI-Masayuki

07/27/2024 at 10:21AM