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 5fa95fbdd285680008e41e4b

swap number pairs

Swap the numbers in a bunch of 2-element arrays.

Start file
[2, 1], [5, 4]
[6, 3]
[7, 4]
[8, 2], [12, 11]
End file
[1, 2], [4, 5]
[3, 6]
[4, 7]
[2, 8], [11, 12]

View Diff

1,4c1,4
< [2, 1], [5, 4]
< [6, 3]
< [7, 4]
< [8, 2], [12, 11]
---
> [1, 2], [4, 5]
> [3, 6]
> [4, 7]
> [2, 8], [11, 12]

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 236 remaining solutions by signing in and submitting your own entry
#237 Andrii Soldatenko / @a_soldatenko - Score: 143 - 11/16/20 @ 14:11
:<50-53>nnoremap <silent> gl "_yiw:s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR><c-o>/\w\+\_W\+<CR><c-l><CR><Esc>[201~<CR><Right>gl<Up><Right><Right><Right><Right><Right><Right><Right><Right><Right>.gl<Right>gl<Right>glgl<Right>gl<Right><Right><Right><Right><Right>gl<Esc>:wq!<CR>

0 comments


Created by: @wedesoft

237 active golfers, 1254 entries

Leaderboard (lowest score wins):
26
#121 - Maorun / @Maorun11

06/30/2021 at 02:04PM

27
#122 - Rafal C. / @RafalC37709324

11/14/2020 at 12:57PM

27
#123 - Matt DB / @MattDB12

12/06/2020 at 05:57PM

27
#124 - Eric Banisadr / @ebanisadr

12/13/2020 at 11:05AM

27
#125 - fray bauhaus / @BauhausFray

01/12/2021 at 12:38PM

27
#126 - Doemae / @Doemae02

06/18/2021 at 06:12PM

27
#127 - 0xdrowsy / @0xdrowsy

07/02/2021 at 03:27AM

28
#128 - Stefan Krist / @nerdyness_sk

11/18/2020 at 04:00PM

28
#129 - Jon Liang / @jon__liang

12/18/2020 at 04:48AM

28
#130 - Pavlo Hadzheha / @PHadzheha

01/31/2021 at 05:12PM

28
#131 - Neil Butler / @PinkyinParis

08/23/2021 at 03:38AM

29
#132 - Sebastian W. / @Sebasti91439242

11/15/2020 at 09:07PM

29
#133 - Miguel Prada / @migueluli

11/25/2020 at 03:57PM

30
#134 - Filipe Barroso 💙 / @ABarroso

11/10/2020 at 07:02PM

30
#135 - Aleks Kissinger / @AleksKissinger

11/13/2020 at 07:35PM

30
#136 - Adam MacKinnon / @AmadKinnon

11/23/2020 at 07:12PM

30
#137 - Robert Verst / @r_verst

11/26/2020 at 01:40PM

30
#138 - akabaka / @akabakass

12/04/2020 at 02:36PM

30
#139 - Pieter Kuijpers / @pieterpiq

12/07/2020 at 02:21PM

30
#140 - Fabrizio Perria / @FPerria

12/16/2020 at 04:35PM

30
#141 - thegoncharov / @thegoncharov

12/30/2020 at 07:46AM

30
#142 - Nitesh Rijhwani / @NitzRijhwani

01/05/2021 at 02:24PM

30
#143 - knobbelkesvlaai / @knobbelkesvlaai

01/13/2021 at 10:30AM

30
#144 - tylertucker202 / @tylertucker202

01/18/2021 at 09:02PM

30
#145 - siruichang / @Blessing13Si

01/20/2021 at 10:06AM

30
#146 - Hatchet / @hatxet

01/20/2021 at 09:43PM

30
#147 - Chris Conte / @chriscconte

02/11/2021 at 12:57AM

30
#148 - vimgolf_vinz / @VimgolfV

09/20/2021 at 04:05PM

31
#149 - rr / @rodgeur31

11/09/2020 at 06:55PM

31
#150 - dreamers00 / @dreamers003

01/23/2021 at 10:34PM