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

263 active golfers, 1357 entries

Leaderboard (lowest score wins):
24
#121 - grosa / @_grosa_

06/15/2021 at 03:17AM

24
#122 - Scott Berger / @scottberger

09/24/2021 at 01:04PM

25
#123 - jirgn / @jirgn

11/12/2020 at 01:31AM

25
#124 - John Other / @john_other

12/06/2020 at 04:09AM

25
#125 - Peter Pandorum / @PeterPandorum

08/08/2021 at 09:01AM

25
#126 - Dima Horshenin / @DimaHorshenin

12/03/2021 at 06:36PM

25
#127 - POSIX / @po6ix

01/08/2022 at 05:07AM

26
#128 - Munif Tanjim / @MunifTanjim

11/11/2020 at 08:01PM

26
#129 - MrRubiksSC / @RubiksSc

11/16/2020 at 01:32AM

26
#130 - James Lowenthal / @JamesAnthonyLow

11/22/2020 at 01:45AM

26
#131 - damned-me / @damned_me_

05/25/2021 at 05:44PM

26
#132 - Maorun / @Maorun11

06/30/2021 at 02:04PM

26
#133 - Hommels / @pseudohommels

10/26/2021 at 03:09AM

26
#134 - ややお / @yayaoh

12/24/2021 at 02:13AM

27
#135 - Rafal C. / @RafalC37709324

11/14/2020 at 12:57PM

27
#136 - Matt DB / @MattDB12

12/06/2020 at 05:57PM

27
#137 - Eric Banisadr / @ebanisadr

12/13/2020 at 11:05AM

27
#138 - fray bauhaus / @BauhausFray

01/12/2021 at 12:38PM

27
#139 - Doemae / @Doemae02

06/18/2021 at 06:12PM

27
#140 - 0xdrowsy / @0xdrowsy

07/02/2021 at 03:27AM

27
#141 - AMG / @anmigneer

12/14/2021 at 03:55PM

27
#142 - Selvaganapathy P / @canabady

01/03/2022 at 12:48PM

28
#143 - Stefan Krist / @nerdyness_sk

11/18/2020 at 04:00PM

28
#144 - Jon Liang / @jon__liang

12/18/2020 at 04:48AM

28
#145 - Pavlo Hadzheha / @PHadzheha

01/31/2021 at 05:12PM

28
#146 - Neil Butler / @PinkyinParis

08/23/2021 at 03:38AM

28
#147 - Swaraj Dash / @swarajdash_

11/14/2021 at 08:14PM

29
#148 - Sebastian W. / @Sebasti91439242

11/15/2020 at 09:07PM

29
#149 - Miguel Prada / @migueluli

11/25/2020 at 03:57PM

30
#150 - Filipe 💙 / @ABarroso

11/10/2020 at 07:02PM