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):
30
#151 - Aleks Kissinger / @AleksKissinger

11/13/2020 at 07:35PM

30
#152 - Adam MacKinnon / @AmadKinnon

11/23/2020 at 07:12PM

30
#153 - Robert Verst / @r_verst

11/26/2020 at 01:40PM

30
#154 - akabaka / @akabakass

12/04/2020 at 02:36PM

30
#155 - Pieter Kuijpers / @pieterpiq

12/07/2020 at 02:21PM

30
#156 - Fabrizio Perria / @FPerria

12/16/2020 at 04:35PM

30
#157 - thegoncharov / @thegoncharov

12/30/2020 at 07:46AM

30
#158 - Nitesh Rijhwani / @NitzRijhwani

01/05/2021 at 02:24PM

30
#159 - knobbelkesvlaai / @knobbelkesvlaai

01/13/2021 at 10:30AM

30
#160 - tylertucker202 / @tylertucker202

01/18/2021 at 09:02PM

30
#161 - siruichang / @Blessing13Si

01/20/2021 at 10:06AM

30
#162 - Hatchet / @hatxet

01/20/2021 at 09:43PM

30
#163 - Chris Conte / @chriscconte

02/11/2021 at 12:57AM

30
#164 - vimgolf_vinz / @VimgolfV

09/20/2021 at 04:05PM

30
#165 - Nougatine Naja / @NougatineNaja

01/03/2022 at 03:11PM

31
#166 - rr / @rodgeur31

11/09/2020 at 06:55PM

31
#167 - dreamers00 / @dreamers003

01/23/2021 at 10:34PM

32
#168 - Jan Wedekind / @wedesoft

11/09/2020 at 03:40PM

32
#169 - Harry Uzzell / @HarryMUzzell

11/09/2020 at 03:42PM

32
#170 - Mike Harris / @MikeMJHarris

11/10/2020 at 09:23AM

32
#171 - Jakub / @vr0m

11/11/2020 at 07:51PM

32
#172 - Akkarin / @akkarinka

11/15/2020 at 12:56PM

32
#173 - David / @imdavidhwang

11/16/2020 at 05:31PM

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

11/19/2020 at 11:02AM

32
#175 - __VimGolfer__ / @VimGolfer19

11/30/2020 at 11:56AM

32
#176 - ‎ً / @zanzb

11/30/2020 at 07:11PM

32
#177 - Petru-Armand Bancila / @petruarmand

12/01/2020 at 06:36PM

32
#178 - nd183 / @nd1832

12/03/2020 at 12:25PM

32
#179 - justinhj / @justinhj

12/15/2020 at 06:55AM

32
#180 - yxke / @_yxke

01/14/2021 at 09:21AM