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

299 active golfers, 1611 entries

Leaderboard (lowest score wins):
32
#211 - Ken / @kenc_

01/20/2022 at 06:46AM

32
#212 - 우정민 / @jeongmin2021

10/02/2022 at 07:58PM

33
#213 - Riley John Gibbs / @RileyJohnGibbs

11/20/2020 at 11:35PM

33
#214 - Norman Liu / @normanwliu

12/06/2020 at 06:16AM

33
#215 - Bharath / @Bharath15952517

12/12/2020 at 03:04PM

33
#216 - John Smith / @JohnSmi38307095

03/19/2021 at 02:21PM

33
#217 - Siddharth Murali / @SidTweetsALess

06/25/2022 at 03:23PM

34
#218 - Jonathan Ketner / @Chariotrunner

12/03/2020 at 01:46AM

34
#219 - said / @said13664960

12/16/2020 at 03:24PM

34
#220 - Marcin Dostojewski / @MarcinekAGH

01/10/2021 at 02:55PM

34
#221 - Martin LOUAZEL / @Zbrahark

02/18/2021 at 07:56AM

34
#222 - Vgrbwat / @vgrbwat

06/03/2021 at 03:57AM

34
#223 - François / @mortyZZ

08/01/2021 at 05:41PM

34
#224 - Yochem van Rosmalen / @yoch3m

01/31/2022 at 12:09PM

35
#225 - Tosoa Bacca / @elsifaka

11/10/2020 at 09:06AM

35
#226 - bladehaze / @bladehaze

12/09/2020 at 11:25PM

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

12/19/2020 at 04:31PM

35
#228 - 김범준 / @kmbmjn

01/14/2021 at 06:13AM

36
#229 - Ken Baldwin / @kenbald1

01/19/2021 at 07:00PM

36
#230 - Roman Matzutt / @matzutt

06/13/2021 at 02:00PM

36
#231 - max / @max_vimaster

06/25/2021 at 10:06AM

37
#232 - jgoerner / @jgoerner2

11/11/2020 at 11:22PM

37
#233 - Leander Hendrikx / @leanderhendrikx

11/19/2020 at 01:13PM

37
#234 - — / @Cenarius

12/07/2020 at 01:26AM

37
#235 - artisan bed maker / @ebencooke

12/16/2020 at 03:47AM

37
#236 - Scott Atkins / @scottrick49

05/26/2021 at 07:17PM

37
#237 - Quentin Leroy / @qnleroy

08/22/2021 at 01:34PM

38
#238 - Jan Lukány / @Lukanyj

11/17/2020 at 12:41PM

38
#239 - George Angelopoulos / @g_usermod

02/20/2021 at 06:05PM

38
#240 - Emiliano Vazquez / @vazquezemiliano

05/09/2021 at 04:03AM