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 9v0062d0773d000000000225

Reformat symbols in list

Saw this in some lecture, easy reformatting using multiple cursor in VS Code

Start file
inputs = [ 1 2 3 4 5 ]
outputs
= [ 1 2 3 4 5 ]
End file
inputs = [ i1 i2 i3 i4 i5 ]
outputs
= [ (o1,i1) (o2,i2) (o3,i3) (o4,i4) (o5,i5) ]

View Diff

1,2c1,2
< inputs = [ 1 2 3 4 5 ]
< outputs = [ 1 2 3 4 5 ]
---
> inputs = [ i1 i2 i3 i4 i5 ]
> outputs = [ (o1,i1) (o2,i2) (o3,i3) (o4,i4) (o5,i5) ]

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 348 remaining solutions by signing in and submitting your own entry
#349 陈宏义 / @mason_chen_cn - Score: 202 - 09/12/22 @ 15:29
<Esc>:1,1s/[]<Left>0<BS>1-5<Right><Left><Left><Left><Left><Left>(<Right><Right><Right><Right><Right>)/i$1/g<CR>/<BS>:1s/([1-5]+)/i()<BS><BS>1<BS>$1.g<CR>/[]<Left>1-5<CR>nnnnnnnnn:s<BS>1,1s/[1-5]/i[]<Left>1-5<Right>/g<CR><Esc>u:s/<BS><BS>1s/[1-5]/$<Left><Left><Left><Left><Left><Left><Left>\(<Right><Right><Right><Right><Right>\)<Right><Right><BS>i\1/g<CR>s/<BS>i<Esc>:2s<BS>,<BS>s/\(1-5<Left><Left><Left>[<Right><Right><Right>]\)/\[<BS><BS>(o\1,i\1)/g<CR>`;<Esc><Esc>:w<CR>:q!<CR>

0 comments


Created by: @selfuryon

349 active golfers, 1625 entries

Leaderboard (lowest score wins):
24
#61 - Don'tBeAlarmed / @DontBeAlarmed

05/31/2024 at 08:28PM

24
#62 - Peppa Pig / @PeppaPigSg

07/14/2024 at 02:16AM

24
#63 - yexia0 / @yexia0

07/14/2024 at 09:14AM

24
#64 - nickGPT / @nickandbro

08/23/2024 at 02:50PM

24
#65 - Adi / @adi2004

09/21/2024 at 06:21PM

24
#66 - Berel94 / @Berel94

11/12/2024 at 09:34PM

24
#67 - got_windy / @insomnight

12/18/2024 at 06:16AM

25
#68 - Jean George / @JeanGeo20504212

07/16/2022 at 10:39AM

25
#69 - loupiot.veloce / @LoupiotVeloce

07/17/2022 at 03:23PM

25
#70 - wpr__ / @wpr____

07/19/2022 at 02:40PM

25
#71 - Lory / @Lory46845742

07/22/2022 at 03:07PM

25
#72 - GreenPinguin / @GreenPinguin2

07/26/2022 at 11:58AM

25
#73 - Eric Briand / @eric_briand

07/29/2022 at 01:58PM

25
#74 - Léo / @Leo58369183

08/22/2022 at 07:07AM

25
#75 - brett / @brettyukich

08/26/2022 at 03:57PM

25
#76 - 비비빅 / @bibibig80714274

09/05/2022 at 03:54PM

25
#77 - Jonny - Male 2.0.37 / @Jonnytron

09/15/2022 at 02:52PM

25
#78 - Julien Durillon / @juuduu

09/29/2022 at 05:03PM

25
#79 - Vlad Yaglamunov / @VladYaglamunov

10/12/2022 at 01:58PM

25
#80 - WladDalwM / @WladDalwM

10/13/2022 at 03:35PM

25
#81 - JongHwan Kim / @shockrabbit17

10/21/2022 at 12:30AM

25
#82 - Nathan Iszlaub / @NIszlaub

10/21/2022 at 03:53PM

25
#83 - おせよ / @OhSayYo

11/13/2022 at 09:09AM

25
#84 - Kha Nguyen / @__ngtrongkha

11/27/2022 at 04:06PM

25
#85 - Dank City / @ddankcity

12/01/2022 at 09:45PM

25
#86 - jajima / @jajima_jp

12/04/2022 at 10:47AM

25
#87 - Ivan Trepakov / @liontiger23

12/30/2022 at 03:20PM

25
#88 - макар бананович / @babnanbab

02/04/2023 at 10:21PM

25
#89 - James Harvey / @JimmyJamesII

02/12/2023 at 12:03AM

25
#90 - John Huynh / @huynh_j93

02/13/2023 at 06:29PM