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

237 active golfers, 1254 entries

Leaderboard (lowest score wins):
17
#61 - John Doe / @JohnDoe75830353

12/21/2020 at 01:43AM

17
#62 - Ray Dennis / @raysden

12/23/2020 at 05:58PM

17
#63 - nigaslivesmatter / @nigaslivesmatt1

12/27/2020 at 03:36PM

17
#64 - Jung Yeon Park / @park_jungy

12/29/2020 at 04:32PM

17
#65 - Mario Olofo / @mario_olofo

01/02/2021 at 10:04PM

17
#66 - Duncan / @Duncan31503119

01/05/2021 at 09:11PM

17
#67 - A A A / @37fatos

01/09/2021 at 12:50AM

17
#68 - Tinko Minko / @tandikula

01/18/2021 at 11:20PM

17
#69 - Michael / @Michael62785035

05/23/2021 at 11:54PM

17
#70 - Georg Bökman / @BokmanGeorg

07/03/2021 at 04:37PM

17
#71 - I_Don't_Want_This_Account / @IDontWa59298038

07/15/2021 at 12:27AM

17
#72 - ボードゲーム! / @boardgame_JP

07/17/2021 at 10:07PM

17
#73 - Michel Viktor / @tomkpz

08/11/2021 at 08:22PM

17
#74 - Jon Karl Sigurdsson / @Math_Meditation

09/13/2021 at 10:51PM

18
#75 - Ceda EI / @ceda_ei

11/10/2020 at 01:38PM

18
#76 - Saki Gw / @Sakigw

11/12/2020 at 02:06PM

18
#77 - David Kutschke / @D4KU_

11/12/2020 at 10:01PM

18
#78 - Andreas Siegrist / @andreaszwei

11/15/2020 at 12:33AM

18
#79 - Jonáš Šerých / @serycjon

11/15/2020 at 06:08PM

18
#80 - chocolate / @chocola81394123

11/18/2020 at 06:25AM

18
#81 - kse / @kse92733183

11/18/2020 at 04:01PM

18
#82 - ZackBurtAWS / @ZackBurtSDE

11/18/2020 at 04:10PM

18
#83 - Patty (Dionísio) / @patrickvillela

11/18/2020 at 07:01PM

18
#84 - Tyler Holien / @tylerholien

11/19/2020 at 01:17AM

18
#85 - OtterPy / @OtterPy

01/26/2021 at 03:27PM

18
#86 - grsh / @girish_i_am

05/27/2021 at 08:07AM

19
#87 - Kapildev Neupane / @KapildevNeupane

01/01/2021 at 10:44AM

19
#88 - Björn Struckmeier / @BjrnStruckmeie1

01/03/2021 at 04:55PM

19
#89 - zapakh / @zapakh

01/21/2021 at 05:42AM

20
#90 - Demian Martinez / @demianuco

12/09/2020 at 06:13PM