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

298 active golfers, 1609 entries

Leaderboard (lowest score wins):
30
#181 - thegoncharov / @thegoncharov

12/30/2020 at 07:46AM

30
#182 - Nitesh Rijhwani / @NitzRijhwani

01/05/2021 at 02:24PM

30
#183 - knobbelkesvlaai / @knobbelkesvlaai

01/13/2021 at 10:30AM

30
#184 - tylertucker202 / @tylertucker202

01/18/2021 at 09:02PM

30
#185 - siruichang / @Blessing13Si

01/20/2021 at 10:06AM

30
#186 - Hatchet / @hatxet

01/20/2021 at 09:43PM

30
#187 - Chris Conte / @chriscconte

02/11/2021 at 12:57AM

30
#188 - vimgolf_vinz / @VimgolfV

09/20/2021 at 04:05PM

30
#189 - Nougatine Naja / @NougatineNaja

01/03/2022 at 03:11PM

30
#190 - NicolasWebDev / @NicolasWebDev

04/26/2022 at 08:17PM

31
#191 - rr / @rodgeur31

11/09/2020 at 06:55PM

31
#192 - dreamers00 / @dreamers003

01/23/2021 at 10:34PM

32
#193 - Jan Wedekind / @wedesoft

11/09/2020 at 03:40PM

32
#194 - Harry Uzzell / @HarryMUzzell

11/09/2020 at 03:42PM

32
#195 - Mike Harris / @MikeMJHarris

11/10/2020 at 09:23AM

32
#196 - Jakub / @vr0m

11/11/2020 at 07:51PM

32
#197 - Akkarin / @akkarinka

11/15/2020 at 12:56PM

32
#198 - David / @imdavidhwang

11/16/2020 at 05:31PM

32
#199 - なんとなく鍛えたい気分 / @VpFvUt2dq2BLepg

11/19/2020 at 11:02AM

32
#200 - __VimGolfer__ / @VimGolfer19

11/30/2020 at 11:56AM

32
#201 - ‎ً / @zanzb

11/30/2020 at 07:11PM

32
#202 - Petru-Armand Bancila / @petruarmand

12/01/2020 at 06:36PM

32
#203 - nd183 / @nd1832

12/03/2020 at 12:25PM

32
#204 - justinhj / @justinhj

12/15/2020 at 06:55AM

32
#205 - yxke / @_yxke

01/14/2021 at 09:21AM

32
#206 - JingChen / @ilovejingle

01/18/2021 at 06:17AM

32
#207 - Josh Swift / @Swiftyfish14

01/26/2021 at 06:00PM

32
#208 - Sylvain Dangin / @Sylvaner03

05/18/2021 at 07:21PM

32
#209 - Ryan Cleary / @ry_guy41

12/14/2021 at 01:06AM

32
#210 - Simon / @mopsdiv

12/14/2021 at 10:19PM