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 9v00664f0099000000000275

Reverse even lines

Reverse only the even lines without altering the odd lines.

Start file
:s%.*%\=getline('.').nr2char(113)%|t.|s(.$(&&(|-s-.-s)\\(.\\)\\([\\x71]\\+\\)\\(\\2.*\\))\\2\\3\\1)|-g|s<[^|]*|$<s>..>><|d d|@d|smile|9sl|se key=|x
:s%.*%\=getline('.').nr2char(119)%|t.|s(.$(&&(|-s-.-s)\\(.\\)\\([\\x77]\\+\\)\\(\\2.*\\))\\2\\3\\1)|-g|s<[^|]*|$<s>..>><|d d|@d|X|se key=vim|x
:s%.*%\=getline('.').nr2char(111)%|t.|s(.$(&&(|-s-.-s)\\(.\\)\\([\\x6f]\\+\\)\\(\\2.*\\))\\2\\3\\1)|-g|s<[^|]*|$<s>..>><|d d|@d|h!|x
:s%.*%\=getline('.').nr2char(112)%|t.|s(.$(&&(|-s-.-s)\\(.\\)\\([\\x70]\\+\\)\\(\\2.*\\))\\2\\3\\1)|-g|s<[^|]*|$<s>..>><|d d|@d|smile|sl|se key=|x


# vim:key=vim
End file
:s%.*%\=getline('.').nr2char(113)%|t.|s(.$(&&(|-s-.-s)\\(.\\)\\([\\x71]\\+\\)\\(\\2.*\\))\\2\\3\\1)|-g|s<[^|]*|$<s>..>><|d d|@d|smile|9sl|se key=|x
x|miv=yek es|X|d@|d d|<>>..>s<$|*]|^[<s|g-|)1\\3\\2\\))\\*.2\\(\\)\\+\\]77x\\[(\\)\\.(\\)s-.-s-|(&&($.(s|.t|%)911(rahc2rn.)'.'(enilteg=\%*.%s:
:s%.*%\=getline('.').nr2char(111)%|t.|s(.$(&&(|-s-.-s)\\(.\\)\\([\\x6f]\\+\\)\\(\\2.*\\))\\2\\3\\1)|-g|s<[^|]*|$<s>..>><|d d|@d|h!|x
x|=yek es|ls|elims|d@|d d|<>>..>s<$|*]|^[<s|g-|)1\\3\\2\\))\\*.2\\(\\)\\+\\]07x\\[(\\)\\.(\\)s-.-s-|(&&($.(s|.t|%)211(rahc2rn.)'.'(enilteg=\%*.%s:


# vim:key=vim

View Diff

2c2
< :s%.*%\=getline('.').nr2char(119)%|t.|s(.$(&&(|-s-.-s)\\(.\\)\\([\\x77]\\+\\)\\(\\2.*\\))\\2\\3\\1)|-g|s<[^|]*|$<s>..>><|d d|@d|X|se key=vim|x
---
> x|miv=yek es|X|d@|d d|<>>..>s<$|*]|^[<s|g-|)1\\3\\2\\))\\*.2\\(\\)\\+\\]77x\\[(\\)\\.(\\)s-.-s-|(&&($.(s|.t|%)911(rahc2rn.)'.'(enilteg=\%*.%s:
4c4
< :s%.*%\=getline('.').nr2char(112)%|t.|s(.$(&&(|-s-.-s)\\(.\\)\\([\\x70]\\+\\)\\(\\2.*\\))\\2\\3\\1)|-g|s<[^|]*|$<s>..>><|d d|@d|smile|sl|se key=|x
---
> x|=yek es|ls|elims|d@|d d|<>>..>s<$|*]|^[<s|g-|)1\\3\\2\\))\\*.2\\(\\)\\+\\]07x\\[(\\)\\.(\\)s-.-s-|(&&($.(s|.t|%)211(rahc2rn.)'.'(enilteg=\%*.%s:

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 10 remaining solutions by signing in and submitting your own entry
#11 Aly Thobani / @alythobani - Score: 323 - 05/24/24 @ 22:12
:X<CR><CR><CR>jjjC<50-53>x|=yek es|ls|elims|d@|d d|<>>..>s<$|*]|^[<s|g-|)1\\3\\2\\))\\*.2\\(\\)\\+\\]07x\\[(\\)\\.(\\)s-.-s-|(&&($.(s|.t|%)211(rahc2rn.)'.'(enilteg=\%*.%s:<CR><Esc>[201~<BS><Esc>kkcc<50-53>x|miv=yek es|X|d@|d d|<>>..>s<$|*]|^[<s|g-|)1\\3\\2\\))\\*.2\\(\\)\\+\\]77x\\[(\\)\\.(\\)s-.-s-|(&&($.(s|.t|%)911(rahc2rn.)'.'(enilteg=\%*.%s:<CR><Esc>[201~<BS><Esc>ZZ

0 comments


Created by: @maharba6

11 active golfers, 32 entries

Leaderboard (lowest score wins):
7
#1 - Peppa Pig / @PeppaPi95550250

05/25/2024 at 01:46AM

7
#2 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

05/26/2024 at 08:24AM

9
#3 - Jean George / @JeanGeo20504212

05/23/2024 at 07:32PM

9
#4 - John Braxler / @braxler

05/24/2024 at 12:35PM

9
#5 - alexeypetrenko / @alexeypetrenko

07/03/2024 at 10:30AM

9
#6 - nickGPT / @nickandbro

08/22/2024 at 03:13AM

16
#7 - maharba6 / @maharba6

07/04/2024 at 09:41AM

21
#8 - Sander Meij / @SanderMeij

06/03/2024 at 03:04PM

27
#9 - Thijs / @Liulangzhe98

05/24/2024 at 12:43PM

36
#10 - Lxtharia / @Lxtharia

05/25/2024 at 10:44AM

323
#11 - Aly Thobani / @alythobani

05/24/2024 at 10:12PM