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):
61
#331 - Cindy Zhang / @zcin

01/05/2024 at 06:09AM

63
#332 - Jakob Weickmann / @jweickm

11/28/2023 at 04:38PM

65
#333 - Max Over / @MaxOver79910574

12/11/2022 at 09:55PM

67
#334 - satake0916 / @satake0916

12/22/2023 at 03:55AM

71
#335 - dailybeef / @dailybeef

11/16/2023 at 07:15PM

78
#336 - Dominik Filker / @DFilker

04/23/2023 at 09:16PM

80
#337 - Asenar / @asenar

07/21/2022 at 03:41PM

82
#338 - Daniel Carlander / @DaniCarlander

02/28/2023 at 08:48PM

86
#339 - e1mnos / @e1mnos

10/24/2022 at 12:55PM

90
#340 - Neil Kanakia / @neilkanakia

10/28/2022 at 07:09PM

97
#341 - Teh Shin Yin / @teh_yin

08/29/2023 at 05:33AM

110
#342 - Liquaberg / @Liq1_1

09/22/2022 at 02:59AM

120
#343 - Sahil Shetty / @sahildshetty

09/26/2022 at 05:52AM

131
#344 - mojito04 / @mojito04

07/19/2024 at 10:06PM

164
#345 - Bansko / @goren_noam

12/04/2022 at 10:55PM

171
#346 - smaso / @iamsmaso

09/17/2022 at 07:39AM

179
#347 - thisisharrison / @thisislharrison

08/08/2022 at 03:37PM

187
#348 - DarChan / @richvote

10/28/2022 at 09:00AM

202
#349 - 陈宏义 / @mason_chen_cn

09/12/2022 at 03:29PM