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):
21
#91 - Bruce Woodward / @b00ffer

11/11/2020 at 10:26AM

21
#92 - Marcin Szamotulski / @me_coot

11/11/2020 at 07:01PM

21
#93 - Arne Winter / @ArneWinter5

11/19/2020 at 01:31PM

21
#94 - Vio / @vioxcd

11/23/2020 at 05:44PM

21
#95 - Askhento / @Askhento1

01/26/2021 at 12:47AM

22
#96 - José / @AngelGaldamez

11/14/2020 at 11:29PM

22
#97 - LeLycal.tar.gz 💾 / @Lycal3

12/01/2020 at 09:59AM

22
#98 - mevmev / @mevmev8

12/04/2020 at 01:06AM

22
#99 - angel / @anmaso

12/04/2020 at 10:30PM

22
#100 - Dave Millican / @dave_millican

01/18/2021 at 12:22PM

22
#101 - Calarasanu Andrei / @_fanfani4_

05/28/2021 at 03:01PM

23
#102 - Vinícius Hoyer / @viniciushoyer

11/09/2020 at 06:14PM

23
#103 - RaylanFox / @RaylanFox

11/10/2020 at 08:17AM

23
#104 - Amar Battulga / @amar_battulga

11/10/2020 at 11:01PM

23
#105 - Wayne / @lilwayne15561

11/14/2020 at 03:28AM

23
#106 - pady. 🇪🇺 / @hundertzwoelf_

12/01/2020 at 04:11PM

23
#107 - altamente / @altamnt

12/01/2020 at 05:00PM

23
#108 - Vinicius Gardelli / @itsthegards

12/01/2020 at 08:13PM

23
#109 - speisz / @speiszc

01/20/2021 at 10:34PM

24
#110 - majo senf / @majo_senf

11/13/2020 at 09:17AM

24
#111 - SEbbaDK / @SEbbaDK

12/04/2020 at 02:54PM

24
#112 - 大矢元海 / @008Genkai

01/07/2021 at 02:03AM

24
#113 - grosa / @_grosa_

06/15/2021 at 03:17AM

25
#114 - jirgn / @jirgn

11/12/2020 at 01:31AM

25
#115 - John Other / @john_other

12/06/2020 at 04:09AM

25
#116 - Peter Pandorum / @PeterPandorum

08/08/2021 at 09:01AM

26
#117 - Munif Tanjim / @MunifTanjim

11/11/2020 at 08:01PM

26
#118 - MrRubiksSC / @RubiksSc

11/16/2020 at 01:32AM

26
#119 - James Lowenthal / @JamesAnthonyLow

11/22/2020 at 01:45AM

26
#120 - damned-me / @damned_me_

05/25/2021 at 05:44PM