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

81 active golfers, 377 entries

Leaderboard (lowest score wins):
18
#31 - Patty (Dionísio) / @patrickvillela

11/18/2020 at 07:01PM

18
#32 - Tyler Holien / @tylerholien

11/19/2020 at 01:17AM

21
#33 - Bruce Woodward / @b00ffer

11/11/2020 at 10:26AM

21
#34 - Marcin Szamotulski / @me_coot

11/11/2020 at 07:01PM

21
#35 - Arne Winter / @ArneWinter5

11/19/2020 at 01:31PM

21
#36 - Vio / @vioxcd

11/23/2020 at 05:44PM

22
#37 - José / @AngelGaldamez

11/14/2020 at 11:29PM

23
#38 - Vinícius Hoyer / @viniciushoyer

11/09/2020 at 06:14PM

23
#39 - RaylanFox / @RaylanFox

11/10/2020 at 08:17AM

23
#40 - Amar Battulga / @amar_battulga

11/10/2020 at 11:01PM

23
#41 - Wayne / @lilwayne15561

11/14/2020 at 03:28AM

24
#42 - majo senf / @majo_senf

11/13/2020 at 09:17AM

25
#43 - jirgn / @jirgn

11/12/2020 at 01:31AM

26
#44 - Munif Tanjim / @MunifTanjim

11/11/2020 at 08:01PM

26
#45 - MrRubiksSC / @RubiksSc

11/16/2020 at 01:32AM

26
#46 - James Lowenthal / @JamesAnthonyLow

11/22/2020 at 01:45AM

27
#47 - Rafal C. / @RafalC37709324

11/14/2020 at 12:57PM

28
#48 - Stefan Krist / @nerdyness_sk

11/18/2020 at 04:00PM

29
#49 - Sebastian W. / @Sebasti91439242

11/15/2020 at 09:07PM

29
#50 - Miguel Prada / @migueluli

11/25/2020 at 03:57PM

30
#51 - Filipe Barroso 💙 / @ABarroso

11/10/2020 at 07:02PM

30
#52 - Aleks Kissinger / @AleksKissinger

11/13/2020 at 07:35PM

30
#53 - Adam MacKinnon / @AmadKinnon

11/23/2020 at 07:12PM

30
#54 - Robert Verst / @r_verst

11/26/2020 at 01:40PM

31
#55 - rr / @rodgeur31

11/09/2020 at 06:55PM

32
#56 - Jan Wedekind / @wedesoft

11/09/2020 at 03:40PM

32
#57 - Harry Uzzell / @HarryMUzzell

11/09/2020 at 03:42PM

32
#58 - Mike Harris / @MikeMJHarris

11/10/2020 at 09:23AM

32
#59 - Jakub / @vr0m

11/11/2020 at 07:51PM

32
#60 - Akkarin / @akkarinka

11/15/2020 at 12:56PM