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

236 active golfers, 1251 entries

Leaderboard (lowest score wins):
16
#1 - Hugh / @haquaman

11/23/2020 at 03:49AM

16
#2 - hepebexè / @hepebexe

11/23/2020 at 06:19PM

16
#3 - John Braxler / @braxler

11/24/2020 at 07:36PM

16
#4 - Alice / @Alice92541388

11/25/2020 at 09:33PM

16
#5 - Andreas Näsman / @andreas_nasman

11/26/2020 at 08:06PM

16
#6 - 六弦 / @liuxian1990

11/28/2020 at 11:46AM

16
#7 - f a / @5eraf

12/02/2020 at 03:46PM

16
#8 - Dax / @zacoxi

12/04/2020 at 01:06AM

16
#9 - windy / @LkzWindy

12/04/2020 at 08:20AM

16
#10 - Alek Mugnozzo / @mugnozzo

12/04/2020 at 03:31PM

16
#11 - Daniel Steinberg / @dstein64

12/07/2020 at 07:34PM

16
#12 - Ryan Way / @RyanWay16

12/08/2020 at 11:10PM

16
#13 - Miłosz Łakomy / @foobar01123

12/11/2020 at 03:33PM

16
#14 - Zhenkai W. / @Zhenkai_W

12/24/2020 at 04:25AM

16
#15 - Blake Tereau / @BlakeTereau

12/24/2020 at 07:08PM

16
#16 - Nicolas Pagny / @NicolasPagny

01/01/2021 at 09:38PM

16
#17 - Andac Safa / @SanDForcE94

01/03/2021 at 01:34PM

16
#18 - Dirty Harry / @TateDirty

01/04/2021 at 04:45AM

16
#19 - Ding Liu / @Nimrod0901

01/04/2021 at 06:18PM

16
#20 - Marion Oldman / @ThatBigCock

01/16/2021 at 07:20PM

16
#21 - Sergei Blinov / @awnion

01/17/2021 at 04:40AM

16
#22 - Horst / @Horst91706815

01/19/2021 at 02:35PM

16
#23 - Ben Simmons / @Simmons_Ben

01/20/2021 at 04:19PM

16
#24 - 蔡徐坤真是爱吃屎 / @Hashub7

01/23/2021 at 03:02PM

16
#25 - notctsk / @notctsk

01/24/2021 at 05:02PM

16
#26 - gimmie fromage / @FromageGimmie

01/25/2021 at 01:26PM

16
#27 - Ben Sherman / @bensherman

01/26/2021 at 01:07AM

16
#28 - Darrin Mourer / @dmourer

01/26/2021 at 04:10PM

16
#29 - Jianfeng / @Jianfen22425058

01/28/2021 at 02:58AM

16
#30 - Arya Kumar / @SusSquirrel

05/17/2021 at 03:38PM