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):
32
#181 - JingChen / @ilovejingle

01/18/2021 at 06:17AM

32
#182 - Josh Swift / @Swiftyfish14

01/26/2021 at 06:00PM

32
#183 - Sylvain Dangin / @Sylvaner03

05/18/2021 at 07:21PM

32
#184 - Ryan Cleary / @ry_guy41

12/14/2021 at 01:06AM

32
#185 - Simon / @mopsdiv

12/14/2021 at 10:19PM

32
#186 - Ken / @kenc_

01/20/2022 at 06:46AM

33
#187 - Riley John Gibbs / @RileyJohnGibbs

11/20/2020 at 11:35PM

33
#188 - Norman Liu / @normanwliu

12/06/2020 at 06:16AM

33
#189 - Bharath / @Bharath15952517

12/12/2020 at 03:04PM

33
#190 - John Smith / @JohnSmi38307095

03/19/2021 at 02:21PM

34
#191 - Jonathan Ketner / @Chariotrunner

12/03/2020 at 01:46AM

34
#192 - said / @said13664960

12/16/2020 at 03:24PM

34
#193 - Marcin Dostojewski / @MarcinekAGH

01/10/2021 at 02:55PM

34
#194 - Martin LOUAZEL / @Zbrahark

02/18/2021 at 07:56AM

34
#195 - Vgrbwat / @vgrbwat

06/03/2021 at 03:57AM

34
#196 - François / @mortyZZ

08/01/2021 at 05:41PM

35
#197 - Tosoa Bacca / @elsifaka

11/10/2020 at 09:06AM

35
#198 - bladehaze / @bladehaze

12/09/2020 at 11:25PM

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

12/19/2020 at 04:31PM

35
#200 - 김범준 / @kmbmjn

01/14/2021 at 06:13AM

36
#201 - Ken Baldwin / @kenbald1

01/19/2021 at 07:00PM

36
#202 - Roman Matzutt / @matzutt

06/13/2021 at 02:00PM

36
#203 - max / @max_vimaster

06/25/2021 at 10:06AM

37
#204 - jgoerner / @jgoerner2

11/11/2020 at 11:22PM

37
#205 - Leander Hendrikx / @leanderhendrikx

11/19/2020 at 01:13PM

37
#206 - — / @Cenarius

12/07/2020 at 01:26AM

37
#207 - artisan bed maker / @ebencooke

12/16/2020 at 03:47AM

37
#208 - Scott Atkins / @scottrick49

05/26/2021 at 07:17PM

37
#209 - Quentin Leroy / @qnleroy

08/22/2021 at 01:34PM

38
#210 - Jan Lukány / @Lukanyj

11/17/2020 at 12:41PM