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):
16
#31 - pikjes / @pikjes2

07/14/2021 at 01:14PM

16
#32 - 悟史 / @A1OBJTxN5fTg5EJ

07/14/2021 at 02:06PM

16
#33 - lydxn / @lydxn1

07/28/2021 at 11:34PM

16
#34 - Hourann Lin / @HourannLin

08/05/2021 at 04:28PM

16
#35 - Roman Privalov / @RomanPrivalov

08/22/2021 at 02:42PM

16
#36 - yancy / @yancy_dong

09/16/2021 at 11:46AM

17
#37 - Jon Krause / @jkrause314

11/09/2020 at 10:16PM

17
#38 - Ansel Bobrow / @garlicWharfRat

11/10/2020 at 04:32AM

17
#39 - Smylers / @Smylers2

11/10/2020 at 11:04AM

17
#40 - Ricardo Lima / @ricponteslima

11/10/2020 at 05:18PM

17
#41 - Jacques Donnelly / @Donnll

11/10/2020 at 09:27PM

17
#42 - Filipe Brandenburger / @filbranden

11/10/2020 at 11:52PM

17
#43 - Leo / @badangos

11/12/2020 at 08:22AM

17
#44 - TW / @tangw

11/12/2020 at 11:13PM

17
#45 - AAbraxas / @AAbraxas1

11/15/2020 at 08:29PM

17
#46 - 김도현 / @pykJzzzsmAzloZl

11/16/2020 at 01:55AM

17
#47 - Ravi S Sinha / @ambidextrousTx

11/17/2020 at 12:19AM

17
#48 - せいほう / @FICSQF

11/17/2020 at 10:33AM

17
#49 - Lashoun / @lashoun42

11/17/2020 at 02:40PM

17
#50 - drumstix576 / @drumstix576

11/18/2020 at 08:09PM

17
#51 - why.degree / @WhyDegree

11/24/2020 at 11:43AM

17
#52 - quemeraisc / @quemeraisc

11/24/2020 at 04:53PM

17
#53 - 刘宏亮 / @CoyAkey

11/25/2020 at 01:05PM

17
#54 - Adam Stephen / @2_71828

11/29/2020 at 11:12AM

17
#55 - Alex Watson / @AlexDewiWatson

11/29/2020 at 05:52PM

17
#56 - roudens / @roudens2

12/03/2020 at 04:48PM

17
#57 - NieDżejkob / @NieDzejkob

12/08/2020 at 04:18PM

17
#58 - Nikhil / @nikhilcsb

12/08/2020 at 09:46PM

17
#59 - 영훈 / @odjfnrtm

12/09/2020 at 06:30AM

17
#60 - Jon Powers / @JonKPowers

12/13/2020 at 02:04AM