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):
18
#91 - Jean George / @JeanGeo20504212

10/23/2021 at 11:36PM

19
#92 - Kapildev Neupane / @KapildevNeupane

01/01/2021 at 10:44AM

19
#93 - Björn Struckmeier / @BjrnStruckmeie1

01/03/2021 at 04:55PM

19
#94 - zapakh / @zapakh

01/21/2021 at 05:42AM

20
#95 - Demian Martinez / @demianuco

12/09/2020 at 06:13PM

20
#96 - $HA-|| / @s_k0731

01/01/2022 at 02:59AM

21
#97 - Bruce Woodward / @b00ffer

11/11/2020 at 10:26AM

21
#98 - Marcin Szamotulski / @me_coot

11/11/2020 at 07:01PM

21
#99 - Arne Winter / @ArneWinter5

11/19/2020 at 01:31PM

21
#100 - Vio / @vioxcd

11/23/2020 at 05:44PM

21
#101 - Askhento / @Askhento1

01/26/2021 at 12:47AM

21
#102 - Alessandro Cantini / @aecant

10/06/2021 at 05:25PM

22
#103 - José / @AngelGaldamez

11/14/2020 at 11:29PM

22
#104 - LeLycal.tar.gz 💾 / @Lycal3

12/01/2020 at 09:59AM

22
#105 - mevmev / @mevmev8

12/04/2020 at 01:06AM

22
#106 - angel / @anmaso

12/04/2020 at 10:30PM

22
#107 - Dave Millican / @dave_millican

01/18/2021 at 12:22PM

22
#108 - Calarasanu Andrei / @_fanfani4_

05/28/2021 at 03:01PM

22
#109 - Vladislav Straka / @StrakaVladislav

11/24/2021 at 01:36AM

23
#110 - Vinícius Hoyer / @viniciushoyer

11/09/2020 at 06:14PM

23
#111 - RaylanFox / @RaylanFox

11/10/2020 at 08:17AM

23
#112 - Amar Battulga / @amar_battulga

11/10/2020 at 11:01PM

23
#113 - Wayne / @lilwayne15561

11/14/2020 at 03:28AM

23
#114 - pady. 🇪🇺 / @hundertzwoelf_

12/01/2020 at 04:11PM

23
#115 - altamente / @altamnt

12/01/2020 at 05:00PM

23
#116 - Vinicius Gardelli / @itsthegards

12/01/2020 at 08:13PM

23
#117 - speisz / @speiszc

01/20/2021 at 10:34PM

24
#118 - majo senf / @majo_senf

11/13/2020 at 09:17AM

24
#119 - SEbbaDK / @SEbbaDK

12/04/2020 at 02:54PM

24
#120 - 大矢元海 / @008Genkai

01/07/2021 at 02:03AM