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):
36
#181 - Ken Baldwin / @kenbald1

01/19/2021 at 07:00PM

36
#182 - Roman Matzutt / @matzutt

06/13/2021 at 02:00PM

36
#183 - max / @max_vimaster

06/25/2021 at 10:06AM

37
#184 - jgoerner / @jgoerner2

11/11/2020 at 11:22PM

37
#185 - Leander Hendrikx / @leanderhendrikx

11/19/2020 at 01:13PM

37
#186 - — / @Cenarius

12/07/2020 at 01:26AM

37
#187 - artisan bed maker / @ebencooke

12/16/2020 at 03:47AM

37
#188 - Scott Atkins / @scottrick49

05/26/2021 at 07:17PM

37
#189 - Quentin Leroy / @qnleroy

08/22/2021 at 01:34PM

38
#190 - Jan Lukány / @Lukanyj

11/17/2020 at 12:41PM

38
#191 - George Angelopoulos / @g_usermod

02/20/2021 at 06:05PM

38
#192 - Emiliano Vazquez / @vazquezemiliano

05/09/2021 at 04:03AM

38
#193 - Patrick Gates / @patrickgates

06/19/2021 at 09:28PM

39
#194 - Anil Narayan / @AnilNarayan2013

11/11/2020 at 04:49AM

39
#195 - Kitsan / @Strustle

11/22/2020 at 11:27AM

40
#196 - Jake Grossman / @PiranaLaugh

11/11/2020 at 04:54PM

40
#197 - Steffen / @Pions90

12/06/2020 at 03:07PM

40
#198 - kijete3127 / @kijete3127

12/13/2020 at 01:20PM

40
#199 - Danny T / @son_of_torkel

12/25/2020 at 04:05PM

40
#200 - Nishanth Reddy / @Nishanth2066

01/19/2021 at 05:21AM

40
#201 - Xiao Wangwang / @WangwangXiao

01/20/2021 at 06:04PM

40
#202 - Thomas Lüdecke / @t0mM3k

01/21/2021 at 12:43PM

40
#203 - Faizan Ansari / @faizan_157

01/31/2021 at 08:16AM

41
#204 - Rory Smith / @alan0buchanan

09/14/2021 at 10:08PM

41
#205 - Yeontaek Kim / @YeontaekK

09/17/2021 at 12:20PM

42
#206 - ajay.vimgolf / @AjayVimgolf

11/11/2020 at 03:54PM

42
#207 - joao neto / @joaonet49907796

05/18/2021 at 11:46AM

45
#208 - hejhopp87 / @hejhopp87

12/05/2020 at 08:11PM

46
#209 - Noise Official / @zmunk19

11/12/2020 at 08:33AM

46
#210 - Alex Kubica / @alexkubicail

11/12/2020 at 10:11AM