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):
32
#151 - Jan Wedekind / @wedesoft

11/09/2020 at 03:40PM

32
#152 - Harry Uzzell / @HarryMUzzell

11/09/2020 at 03:42PM

32
#153 - Mike Harris / @MikeMJHarris

11/10/2020 at 09:23AM

32
#154 - Jakub / @vr0m

11/11/2020 at 07:51PM

32
#155 - Akkarin / @akkarinka

11/15/2020 at 12:56PM

32
#156 - David / @imdavidhwang

11/16/2020 at 05:31PM

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

11/19/2020 at 11:02AM

32
#158 - __VimGolfer__ / @VimGolfer19

11/30/2020 at 11:56AM

32
#159 - ‎ً / @zanzb

11/30/2020 at 07:11PM

32
#160 - Petru-Armand Bancila / @petruarmand

12/01/2020 at 06:36PM

32
#161 - nd183 / @nd1832

12/03/2020 at 12:25PM

32
#162 - justinhj / @justinhj

12/15/2020 at 06:55AM

32
#163 - yxke / @_yxke

01/14/2021 at 09:21AM

32
#164 - JingChen / @ilovejingle

01/18/2021 at 06:17AM

32
#165 - Josh Swift / @Swiftyfish14

01/26/2021 at 06:00PM

32
#166 - Sylvain Dangin / @Sylvaner03

05/18/2021 at 07:21PM

33
#167 - Riley John Gibbs / @RileyJohnGibbs

11/20/2020 at 11:35PM

33
#168 - Norman Liu / @normanwliu

12/06/2020 at 06:16AM

33
#169 - Bharath / @Bharath15952517

12/12/2020 at 03:04PM

33
#170 - John Smith / @JohnSmi38307095

03/19/2021 at 02:21PM

34
#171 - Jonathan Ketner / @Chariotrunner

12/03/2020 at 01:46AM

34
#172 - said / @said13664960

12/16/2020 at 03:24PM

34
#173 - Marcin Dostojewski / @MarcinekAGH

01/10/2021 at 02:55PM

34
#174 - Martin LOUAZEL / @Zbrahark

02/18/2021 at 07:56AM

34
#175 - Vgrbwat / @vgrbwat

06/03/2021 at 03:57AM

34
#176 - François / @mortyZZ

08/01/2021 at 05:41PM

35
#177 - Tosoa Bacca / @elsifaka

11/10/2020 at 09:06AM

35
#178 - bladehaze / @bladehaze

12/09/2020 at 11:25PM

35
#179 - 正気・腕力・不労所得 / @tsukimizake774

12/19/2020 at 04:31PM

35
#180 - 김범준 / @kmbmjn

01/14/2021 at 06:13AM