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

81 active golfers, 377 entries

Leaderboard (lowest score wins):
32
#61 - David / @imdavidhwang

11/16/2020 at 05:31PM

32
#62 - なんとなく鍛えたい気分 / @VpFvUt2dq2BLepg

11/19/2020 at 11:02AM

33
#63 - Riley John Gibbs / @RileyJohnGibbs

11/20/2020 at 11:35PM

35
#64 - Tosoa Bacca / @elsifaka

11/10/2020 at 09:06AM

37
#65 - jgoerner / @jgoerner2

11/11/2020 at 11:22PM

37
#66 - Leander Hendrikx / @leanderhendrikx

11/19/2020 at 01:13PM

37
#67 - dreamers00 / @dreamers003

11/23/2020 at 11:10AM

38
#68 - Jan Lukány / @Lukanyj

11/17/2020 at 12:41PM

39
#69 - Anil Narayan / @AnilNarayan2013

11/11/2020 at 04:49AM

39
#70 - Kitsan / @Strustle

11/22/2020 at 11:27AM

40
#71 - Jake Grossman / @PiranaLaugh

11/11/2020 at 04:54PM

42
#72 - ajay.vimgolf / @AjayVimgolf

11/11/2020 at 03:54PM

46
#73 - Noise Official / @zmunk19

11/12/2020 at 08:33AM

46
#74 - Alex Kubica / @alexkubicail

11/12/2020 at 10:11AM

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

11/15/2020 at 04:28PM

52
#76 - Ken Powers / @knpwrs

11/11/2020 at 03:25PM

58
#77 - Dennis Chen / @Mailyfesux

11/12/2020 at 05:18AM

64
#78 - Joshua Parco / @JoshuaParco2

11/09/2020 at 07:01PM

65
#79 - Yondonjamts / @yondonjamts_g

11/13/2020 at 11:30AM

76
#80 - Malik Ouda / @malik_ouda

11/23/2020 at 07:36PM

143
#81 - Andrii Soldatenko / @a_soldatenko

11/16/2020 at 02:11PM