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

173 active golfers, 911 entries

Leaderboard (lowest score wins):
26
#91 - James Lowenthal / @JamesAnthonyLow

11/22/2020 at 01:45AM

27
#92 - Rafal C. / @RafalC37709324

11/14/2020 at 12:57PM

27
#93 - Matt DB / @MattDB12

12/06/2020 at 05:57PM

27
#94 - Eric Banisadr / @ebanisadr

12/13/2020 at 11:05AM

27
#95 - fray bauhaus / @BauhausFray

01/12/2021 at 12:38PM

28
#96 - Stefan Krist / @nerdyness_sk

11/18/2020 at 04:00PM

28
#97 - Jon Liang / @jon__liang

12/18/2020 at 04:48AM

29
#98 - Sebastian W. / @Sebasti91439242

11/15/2020 at 09:07PM

29
#99 - Miguel Prada / @migueluli

11/25/2020 at 03:57PM

30
#100 - Filipe Barroso 💙 / @ABarroso

11/10/2020 at 07:02PM

30
#101 - Aleks Kissinger / @AleksKissinger

11/13/2020 at 07:35PM

30
#102 - Adam MacKinnon / @AmadKinnon

11/23/2020 at 07:12PM

30
#103 - Robert Verst / @r_verst

11/26/2020 at 01:40PM

30
#104 - akabaka / @akabakass

12/04/2020 at 02:36PM

30
#105 - Pieter Kuijpers / @pieterpiq

12/07/2020 at 02:21PM

30
#106 - Fabrizio Perria / @FPerria

12/16/2020 at 04:35PM

30
#107 - thegoncharov / @thegoncharov

12/30/2020 at 07:46AM

30
#108 - Nitesh Rijhwani / @NitzRijhwani

01/05/2021 at 02:24PM

30
#109 - knobbelkesvlaai / @knobbelkesvlaai

01/13/2021 at 10:30AM

30
#110 - speisz / @speiszc

01/17/2021 at 10:30PM

30
#111 - tylertucker202 / @tylertucker202

01/18/2021 at 09:02PM

31
#112 - rr / @rodgeur31

11/09/2020 at 06:55PM

32
#113 - Jan Wedekind / @wedesoft

11/09/2020 at 03:40PM

32
#114 - Harry Uzzell / @HarryMUzzell

11/09/2020 at 03:42PM

32
#115 - Mike Harris / @MikeMJHarris

11/10/2020 at 09:23AM

32
#116 - Jakub / @vr0m

11/11/2020 at 07:51PM

32
#117 - Akkarin / @akkarinka

11/15/2020 at 12:56PM

32
#118 - David / @imdavidhwang

11/16/2020 at 05:31PM

32
#119 - ăȘんべăȘăé›ăˆăŸă„æ°—ćˆ† / @VpFvUt2dq2BLepg

11/19/2020 at 11:02AM

32
#120 - __VimGolfer__ / @VimGolfer19

11/30/2020 at 11:56AM