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

276 active golfers, 1409 entries

Leaderboard (lowest score wins):
46
#241 - Alex Kubica / @alexkubicail

11/12/2020 at 10:11AM

47
#242 - vesa / @XingfDu

01/08/2021 at 11:34AM

47
#243 - yevallus / @yevallus

03/10/2022 at 02:53PM

50
#244 - Bo Xie / @iebox

12/05/2020 at 03:52AM

50
#245 - りょー / @ryoo141

01/10/2021 at 03:20AM

50
#246 - panakin skywalker / @_j3ffrey

08/31/2021 at 03:10PM

50
#247 - Ali Aslan / @AliAsla95742367

10/27/2021 at 01:27AM

51
#248 - just here to scroll. / @idontknow0001

11/15/2020 at 04:28PM

51
#249 - math is what I hate / @mpnmbn

03/13/2022 at 10:46AM

51
#250 - aravindthangavel / @aravindpt

04/11/2022 at 04:44AM

52
#251 - Ken Powers / @knpwrs

11/11/2020 at 03:25PM

53
#252 - salchint / @salchint

12/04/2020 at 04:46PM

53
#253 - Just Alerik / @Just_Alerik

12/15/2020 at 10:42PM

53
#254 - Jeremy Thompson / @jeremyt918

09/21/2021 at 11:26PM

55
#255 - Joe Farnsworth / @JoeFarnsworth

06/21/2021 at 09:31PM

56
#256 - sydman / @sydman11

11/18/2021 at 09:01AM

58
#257 - Dennis Chen / @Mailyfesux

11/12/2020 at 05:18AM

59
#258 - dvorak4tzx / @dvorak4tzx4

12/28/2020 at 04:49PM

59
#259 - Kevin Linnane / @linnanekevin07

12/30/2020 at 10:01PM

59
#260 - iiooii / @APR_PLUS

12/31/2021 at 02:49AM

63
#261 - vr4vc4 / @vr4vc4

03/21/2022 at 07:25AM

64
#262 - Joshua Parco / @JoshuaParco2

11/09/2020 at 07:01PM

65
#263 - Yondonjamts Ganzorig / @yondonjamts_g

11/13/2020 at 11:30AM

67
#264 - monad / @skoblock

12/12/2020 at 05:04PM

67
#265 - SpadeAcademic / @AcademicSpade

01/15/2021 at 06:56AM

68
#266 - Chae Eon Lim / @ChaeEonLim1

06/13/2021 at 05:26AM

72
#267 - Jacob Wood / @jacoblandonwood

06/15/2021 at 03:22AM

76
#268 - Malik Ouda / @malik_ouda

11/23/2020 at 07:36PM

78
#269 - danielchang2002 / @danielchang2002

12/07/2020 at 08:17PM

79
#270 - mathieu524287 / @mathieu524287

12/20/2020 at 11:52AM