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):
22
#121 - LeLycal.tar.gz πŸ’Ύ / @Lycal3

12/01/2020 at 09:59AM

22
#122 - mevmev / @mevmev8

12/04/2020 at 01:06AM

22
#123 - angel / @anmaso

12/04/2020 at 10:30PM

22
#124 - Dave Millican / @dave_millican

01/18/2021 at 12:22PM

22
#125 - Calarasanu Andrei / @_fanfani4_

05/28/2021 at 03:01PM

22
#126 - Vladislav Straka / @StrakaVladislav

11/24/2021 at 01:36AM

22
#127 - POSIX / @po6ix

02/01/2022 at 04:42AM

22
#128 - πš‹πš›πš’πšŠπš— / @Brianjp93

05/06/2022 at 05:45PM

22
#129 - brett / @brettyukich

09/05/2022 at 03:53PM

23
#130 - VinΓ­cius Hoyer / @viniciushoyer

11/09/2020 at 06:14PM

23
#131 - RaylanFox / @RaylanFox

11/10/2020 at 08:17AM

23
#132 - Amar Battulga / @amar_battulga

11/10/2020 at 11:01PM

23
#133 - Wayne / @lilwayne15561

11/14/2020 at 03:28AM

23
#134 - pady. πŸ‡ͺπŸ‡Ί / @hundertzwoelf_

12/01/2020 at 04:11PM

23
#135 - altamente / @altamnt

12/01/2020 at 05:00PM

23
#136 - Vinicius Gardelli / @itsthegards

12/01/2020 at 08:13PM

23
#137 - speisz / @speiszc

01/20/2021 at 10:34PM

23
#138 - ._. / @Katharsic

04/24/2022 at 02:25PM

23
#139 - Golfer / @Golfer56598542

06/24/2022 at 11:51AM

24
#140 - majo senf / @majo_senf

11/13/2020 at 09:17AM

24
#141 - SEbbaDK / @SEbbaDK

12/04/2020 at 02:54PM

24
#142 - ε€§ηŸ’ε…ƒζ΅· / @008Genkai

01/07/2021 at 02:03AM

24
#143 - grosa / @_grosa_

06/15/2021 at 03:17AM

24
#144 - Scott Berger / @scottberger

09/24/2021 at 01:04PM

25
#145 - jirgn / @jirgn

11/12/2020 at 01:31AM

25
#146 - John Other / @john_other

12/06/2020 at 04:09AM

25
#147 - Peter Pandorum / @PeterPandorum

08/08/2021 at 09:01AM

25
#148 - Dima Horshenin / @DimaHorshenin

12/03/2021 at 06:36PM

25
#149 - Ilay Skutelsky / @ISkutelsky

08/02/2022 at 06:11AM

26
#150 - Munif Tanjim / @MunifTanjim

11/11/2020 at 08:01PM