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):
47
#211 - vesa / @XingfDu

01/08/2021 at 11:34AM

47
#212 - ._. / @Katharsic

05/16/2021 at 10:15AM

50
#213 - Bo Xie / @iebox

12/05/2020 at 03:52AM

50
#214 - りょー / @ryoo141

01/10/2021 at 03:20AM

50
#215 - panakin skywalker / @_j3ffrey

08/31/2021 at 03:10PM

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

11/15/2020 at 04:28PM

52
#217 - Ken Powers / @knpwrs

11/11/2020 at 03:25PM

53
#218 - salchint / @salchint

12/04/2020 at 04:46PM

53
#219 - Just Alerik / @Just_Alerik

12/15/2020 at 10:42PM

55
#220 - Joe Farnsworth / @JoeFarnsworth

06/21/2021 at 09:31PM

58
#221 - Dennis Chen / @Mailyfesux

11/12/2020 at 05:18AM

59
#222 - dvorak4tzx / @dvorak4tzx4

12/28/2020 at 04:49PM

59
#223 - Kevin Linnane / @linnanekevin07

12/30/2020 at 10:01PM

64
#224 - Joshua Parco / @JoshuaParco2

11/09/2020 at 07:01PM

65
#225 - Yondonjamts Ganzorig / @yondonjamts_g

11/13/2020 at 11:30AM

67
#226 - monad / @skoblock

12/12/2020 at 05:04PM

67
#227 - SpadeAcademic / @AcademicSpade

01/15/2021 at 06:56AM

68
#228 - Chae Eon Lim / @ChaeEonLim1

06/13/2021 at 05:26AM

72
#229 - Jacob Wood / @jacoblandonwood

06/15/2021 at 03:22AM

76
#230 - Malik Ouda / @malik_ouda

11/23/2020 at 07:36PM

78
#231 - danielchang2002 / @danielchang2002

12/07/2020 at 08:17PM

79
#232 - mathieu524287 / @mathieu524287

12/20/2020 at 11:52AM

98
#233 - Prabhat Ranjan / @prabhatr27

11/29/2020 at 02:19PM

107
#234 - Shinjini Ghosh / @ShinjiniGhosh00

12/03/2020 at 12:30AM

116
#235 - Khalin George / @Khalin_George

12/02/2020 at 06:42PM

116
#236 - 藤田拓郎 / @FujitaTakuro

05/23/2021 at 11:30AM

143
#237 - Andrii Soldatenko / @a_soldatenko

11/16/2020 at 02:11PM