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):
38
#211 - George Angelopoulos / @g_usermod

02/20/2021 at 06:05PM

38
#212 - Emiliano Vazquez / @vazquezemiliano

05/09/2021 at 04:03AM

38
#213 - Patrick Gates / @patrickgates

06/19/2021 at 09:28PM

39
#214 - Anil Narayan / @AnilNarayan2013

11/11/2020 at 04:49AM

39
#215 - Kitsan / @Strustle

11/22/2020 at 11:27AM

40
#216 - Jake Grossman / @PiranaLaugh

11/11/2020 at 04:54PM

40
#217 - Steffen / @Pions90

12/06/2020 at 03:07PM

40
#218 - kijete3127 / @kijete3127

12/13/2020 at 01:20PM

40
#219 - Danny T / @son_of_torkel

12/25/2020 at 04:05PM

40
#220 - Nishanth Reddy / @Nishanth2066

01/19/2021 at 05:21AM

40
#221 - Xiao Wangwang / @WangwangXiao

01/20/2021 at 06:04PM

40
#222 - Thomas Lüdecke / @t0mM3k

01/21/2021 at 12:43PM

40
#223 - Faizan Ansari / @faizan_157

01/31/2021 at 08:16AM

41
#224 - Rory Smith / @alan0buchanan

09/14/2021 at 10:08PM

41
#225 - Yeontaek Kim / @YeontaekK

09/17/2021 at 12:20PM

42
#226 - ajay.vimgolf / @AjayVimgolf

11/11/2020 at 03:54PM

42
#227 - joao neto / @joaonet49907796

05/18/2021 at 11:46AM

45
#228 - hejhopp87 / @hejhopp87

12/05/2020 at 08:11PM

45
#229 - BOEHBAA / @BOEHBAA

09/29/2021 at 03:18PM

45
#230 - Andrew Tongen / @atongen

11/02/2021 at 07:03PM

46
#231 - Noise Official / @zmunk19

11/12/2020 at 08:33AM

46
#232 - Alex Kubica / @alexkubicail

11/12/2020 at 10:11AM

47
#233 - vesa / @XingfDu

01/08/2021 at 11:34AM

47
#234 - ._. / @Katharsic

05/16/2021 at 10:15AM

50
#235 - Bo Xie / @iebox

12/05/2020 at 03:52AM

50
#236 - りょー / @ryoo141

01/10/2021 at 03:20AM

50
#237 - panakin skywalker / @_j3ffrey

08/31/2021 at 03:10PM

50
#238 - Ali Aslan / @AliAsla95742367

10/27/2021 at 01:27AM

51
#239 - just here to scroll. / @idontknow0001

11/15/2020 at 04:28PM

52
#240 - Ken Powers / @knpwrs

11/11/2020 at 03:25PM