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

103 active golfers, 526 entries

Leaderboard (lowest score wins):
16
#1 - Hugh / @haquaman

11/23/2020 at 03:49AM

16
#2 - hepebexè / @hepebexe

11/23/2020 at 06:19PM

16
#3 - John Braxler / @braxler

11/24/2020 at 07:36PM

16
#4 - Alice / @Alice92541388

11/25/2020 at 09:33PM

16
#5 - Andreas Näsman / @andreas_nasman

11/26/2020 at 08:06PM

16
#6 - 六弦 / @liuxian1990

11/28/2020 at 11:46AM

16
#7 - f a / @5eraf

12/02/2020 at 03:46PM

16
#8 - Dax / @zacoxi

12/04/2020 at 01:06AM

16
#9 - windy / @LkzWindy

12/04/2020 at 08:20AM

17
#10 - Jon Krause / @jkrause314

11/09/2020 at 10:16PM

17
#11 - Ansel Bobrow / @garlicWharfRat

11/10/2020 at 04:32AM

17
#12 - Smylers / @Smylers2

11/10/2020 at 11:04AM

17
#13 - Ricardo Lima / @ricponteslima

11/10/2020 at 05:18PM

17
#14 - Jacques Donnelly / @Donnll

11/10/2020 at 09:27PM

17
#15 - Filipe Brandenburger / @filbranden

11/10/2020 at 11:52PM

17
#16 - Leo / @leosolidum

11/12/2020 at 08:22AM

17
#17 - TW / @tangw

11/12/2020 at 11:13PM

17
#18 - AAbraxas / @AAbraxas1

11/15/2020 at 08:29PM

17
#19 - 김도현 / @pykJzzzsmAzloZl

11/16/2020 at 01:55AM

17
#20 - Ravi S Sinha / @ambidextrousTx

11/17/2020 at 12:19AM

17
#21 - せいほう / @FICSQF

11/17/2020 at 10:33AM

17
#22 - Lashoun / @lashoun42

11/17/2020 at 02:40PM

17
#23 - drumstix576 / @drumstix576

11/18/2020 at 08:09PM

17
#24 - why.degree / @WhyDegree

11/24/2020 at 11:43AM

17
#25 - quemeraisc / @quemeraisc

11/24/2020 at 04:53PM

17
#26 - 刘宏亮 / @CoyAkey

11/25/2020 at 01:05PM

17
#27 - Adam Stephen / @2_71828

11/29/2020 at 11:12AM

17
#28 - Alex Watson / @AlexDewiWatson

11/29/2020 at 05:52PM

17
#29 - roudens / @roudens2

12/03/2020 at 04:48PM

18
#30 - Ceda EI / @ceda_ei

11/10/2020 at 01:38PM